Solved

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

Posted on 2002-07-17
2
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Six Sigma Control Plans

632 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