Solved

How to set a %Session variable% from a client posting script?

Posted on 2002-07-17
2
166 Views
Last Modified: 2010-03-05
Hi, I have struck the following problem in a perl script posting data to a server.

A particular field gets drawn up with javascript and is not able to be posted to in the regular way. It is using some soft of Active X thing which I cannot use on my Linux client calling with a perl client.

Is ther a way I can set the %=Session("ConsReceiverCompany")% Variable in my Perl Client Script?

--SNIP-- PERL CLIENT--
my $request  = $ua->request( POST 'http://www.mypage.com.au/test.asp' );
my $form = HTML::Form->parse( $request->content, $request->base());
$form->value( 'ConsPayee', "S" );  
$form->value( 'ConsReceiverCompany', "My Name" );
my $response = $ua->request( $form->click('cmdSubmit') );
print $response->as_string;
--/SNIP--PERL CLIENT--

Gives an error when run of;
No such field 'ConsReceiverCompany' at book.pl line 62 error

It is however a compulsory to fill in from a standard web browser.

They sent me the ASP server page and I wonder how I can submit/post/set the ConsReceiverCompany as a variable ?

--SNIP ASP WINDOZE SERVER--
<SCRIPT LANGUAGE="JavaScript">
<!--
function handleActiveXError (err, url, line) {

      if (err.indexOf('Automation') != -1) {
            err = "";
            return true; // error is handled
            }
      else {
            alert(err);
            return false; // let the browser handle the error
            }
}
var booFMReceivers = false;

strCompanyEtc = '<tr>'
  + '<td  bgcolor="#cccccc" align="left">'
      + '<font size="2" face="Arial,Verdana" color="#000000">'
          + 'Receiver Company Name:'
      + '</font>'
  + '</td>'
  + '<td bgcolor="#0a4e91">'
      + '<font face="arial,verdana" color="#000000">'
      + '<input type="text" name="ConsReceiverCompany"  size="30" maxlength="30" value="<%=Session("ConsReceiverCompany")%>"><img src="/i/smRedArw.GIF" width="11" height="14">'
      + '</font>'
  + '</td>'
  + '</tr>';

var strSupressCert = false;
if (navigator.appName.indexOf('Microsoft') != -1) {
      var booUseActiveX = null;
      if (navigator.cookieEnabled == true) {
            booUseActiveX = getCookie("ActiveXControls"); }
      if (booUseActiveX == null)
        {
      //      if (confirm("Do you want to download an AaE control to enhance your Receiver Details handling?"))
      //        {
      //            booFMReceivers = true;
      //            booUseActiveX = "Yes";
      //            strSupressCert = true;
      //        }
      //      else
      //        {
      //            booFMReceivers = false;
      //            booUseActiveX = "No";
      //        }
            if (navigator.cookieEnabled == true)
                  setCookie("ActiveXControls",booUseActiveX,10000);
        }                  
      var strAskAgain = "";
//      if (booUseActiveX == "Yes") {
            window.defaultOnError = window.onerror; // store default handler
            window.onerror = handleActiveXError; // assign own handler            
//            window.onerror = NoErrors; // assign own handler            
// run here to allow user to refuse ActiveX Control
              if (strSupressCert)
// don't trigger the download until Receiver object is set up
                    var oReceiver = true;               
              else {
                    var oReceiver = new ActiveXObject('FMReceivers.FMReceiver');}
              
// the rest of the script doesn't get executed anyway if user said No
            window.onerror = window.defaultOnError;  // restore default handler
            if (oReceiver) {
                  booFMReceivers = true; }
            else {
                  booFMReceivers = false; }
//        }
//      else
//        {
          strAskAgain = '<tr><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'
                  + 'Ask me again to download Receiver handling Component? &nbsp;'
                  + '<INPUT type="checkbox" id="chkActiveX" name="chkActiveX" value="checked" onClick="return AskAgain()">'
                  + '</td></tr>';}
//}


if (booFMReceivers)
{
      strVersion = "V1";
      strCompanyEtc = '<tr><td bgcolor="#cccccc" align="left" colspan="2">'
//          + '<OBJECT CLASSID="CLSID:678A494A-CF32-11D5-9BB8-0050DA8C84DD" id="FMReceiver"    codebase="FMReceivers.CAB#version=3,1,0,1"></OBJECT>'
//          + '<OBJECT CLASSID="CLSID:678A494A-CF32-11D5-9BB8-0050DA8C84DD" id="FMReceiver"   codebase="http://173.200.3.248/consignment/FMReceivers.CAB#version=3,1,0,1"></OBJECT>'
          + '<OBJECT CLASSID="CLSID:678A494A-CF32-11D5-9BB8-0050DA8C84DD" id="FMReceiver"   codebase="/consignment/FMReceivers.CAB#version=3,1,0,1"></OBJECT>'
            + '</td></tr>'
            + '<input type="hidden" name="ConsReceiverCompany"  size="30" maxlength="30" value="<%=Session("ConsReceiverCompany")%>">'
      ;
}
//-->
</SCRIPT>
--/SNIP ASP ON WINDOZE SERVER--
0
Comment
Question by:wapware
2 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 200 total points
ID: 7161526
sounds like the ASP script uses cookies instead of the hidden ConsReceiverCompany input tag.
You need to read the cokkies.
0
 
LVL 8

Expert Comment

by:davorg
ID: 9484086
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept ahoffman's comment as an answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
davorg
EE Cleanup Volunteer
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now