Solved

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

Posted on 2002-07-17
2
172 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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending email via Perl on Windows 3 137
sort hash by values desc 2 186
problem with using the glob function 1 63
Vb script to unzip a files and rename the files 5 82
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

911 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

20 Experts available now in Live!

Get 1:1 Help Now