Solved

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

Posted on 2002-07-17
2
179 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
syslog unix file 20 73
ppm conversion to curl on a module install 8 82
.properties file to call function/method 9 61
Is it true to say that Python is successor of Perl? 7 173
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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