Javascript Variables on Form Login using HttpClient

Hi,
I am currently using HttpClient to log onto a forum. As of now I am successfully able to submit a form, which authenticates me, and then takes me to a redirect page(where it welcomes me, stating my username) and then redirects me to the index. On inspecting the code, I saw that some javascript variables are set based on the cookies. However, the httpclient is unable to do this redirection on its own and hence the javascript variables are not getting set and when I subsequently open a new get connection to the index it does not have those javascript variables set and I lose the session.
I hope I've made my problem clear. Is there any way I could set those javascript variables myself?
Thanks.

nikhilm wrote:
some javascript variables are set based on the cookiesThen just send those cookies along with the request. The session is usually maintained through a cookie with some unique identifier. You should have retrieved this cookie in the response of the login request.

Similar Messages

  • How declear global variable in form and use all form

    hi master,
    sir,
    how i declear global variable in form and how use this variable in all form
    i have year table and pik current year or date form table and move in global variable and use in all form
    please give ma idea
    thanking you
    Aamir

    Ok, so, what characterset was your database created with?
    Does that characterset have a representation of that character?
    -Mark

  • Java Applet won't load when a JavaScript variable "this.Document" is used.

    Hi,
    Creating a "this.Document" variable within JavaScript interferes with some versions of Java. So far it breaks on the following versions, using IE7 on Windows XP:
    * JRE 6.0 Update 7
    * JRE 6.0 Update 6
    * JRE 6.0 Update 5
    * JRE 6.0 Update 4
    [Due to time constraints JRE 6.0 to JRE 6.0 Update 3 were not tested]
    * JRE 5.0 Update 22
    [Due to time constraints JRE 5.0 Update 16 to JRE 5.0 Update 21 were not tested]
    * JRE 5.0 Update 15
    [Due to time constraints JRE 5.0 Update 1 to JRE 5.0 Update 14 were not tested]
    * JRE 5.0
    The following HTML demonstrates this problem when you have any of the above versions of Java installed:
    <html>
        <head>
            <title>Java Bug</title>
            <script type="text/javascript" language="javascript">
                this.Document = 'string'; // Remove this line to get it to work again
            </script>
        </head>
        <body style="background-color:black">
            <applet id="testVM" alt="Something is wrong. Java is not working."
                codebase="http://www.java.com/applet" code="testJava2_1/TestVMApplet"
                archive="TestVM2-test.jar" width="500" height="280">
                <param name="locale" value="en" />   
                <param name="titleSize" value="22" />
                <param name="subtitleSize" value="18" />   
            </applet>
        </body>
    </html>The page only displays a white box where the Java Applet should be. If you then remove the "this.Document" variable or simply rename it to something else then the applet loads without problems. Normally I would just use a different variable name but the variable name is placed within the Mootools JavaScript Framework and is not easily changed without forking my own project.
    Does anyone know why this happens and if it can be fixed without having to update to the latest version of Java?
    Thanks

    EJP wrote:
    'this.document' is a predefined variable that defines the URL source of the current page. If you are referring to the predefined variable that provides access to the Document Object Model then I believe you are mistaken, that is 'window.document' or just 'document'.
    EJP wrote:
    Your name either conflicts with that or is getting confused with it somewhere.The 'document' variable is a parent of the window object e.g. 'window.document' but my variable has the context of 'this'. That means 'this.document.URL' returns 'undefined' instead of the URL for the current page.
    JavaScript is also case sensitive so 'document.URL' is not the same as 'Document.URL', the last of which returns 'undefined'.
    If Java relealy was confusing my variable with the predfined one then I would expect the same behaviour if I were to use differnt variations of the variable. However the follwoing JavaScript doesnt affect the Applet in anyway:
    <script type="text/javascript" language="javascript">
        //this.Document = 'string'; // Remove this line to get it to work again
        this.document = 'string';
        document = 'string';
        Document = 'string';            
    </script>For some strange reason it only affects the Applet when 'this.Document' is used. Why would Java be affected in this way in the first instance? Even setting the 'scriptable' parameter to false doesn’t help:
    <param name="scriptable" value="false">Are there any other settings I am not aware of that could maybe prevent Java from loooking at the JavaScript?
    EJP wrote:
    Use another name.As I mentioned in my original post this is not easily done, I can edit the source code on my own site but the code still remains unchanged on the Mootools JavaScript Framework website.
    Thanks

  • Assigning a java value(filepath) to a javascript variable

    I have a JSP where I have a java variable(obtained from session) which is nothing but a filepath(say C:\superb.xpdl). When I try to use the variable in javascript using var scriptVar = "<%= sessionVar %>";, the sessionVar value i.e. the filepath is getting modified (like C:superb.xpdl). Slashes are interpredted in a different way(\t for tab, \n for new line etc.,) How to get the filepath with no modifications while assigning to javascript variable? will encoding(using escape()) and decoding help?

    unfortunately you need to double up the slashes
    maybe this will work
    scriptVar = "<%= sessionVar.replaceAll("\\", "\\\\") %>";
    or maybe it will cause a infinite recursion problem (i'm too lazy to try it)

  • Accessing javascript using HttpClient API

    Hi,
    I am using HttpClient API to access the content of page.Using that API
    I am able to retrive the content of the first page(The page Prior to Login).
    Now I want to login with user id and password.I have tried with PostMethod() but the content(in HtML Form) that I am getting is not of the next page but of the same page i.e. I am unable to login.
    I have seen the html content of the first page(by View Source from Browser) and there in the form tag on onsubmit event there is a call to a javascript function which is encrypting the password field.
    Can any body let me know how to deal with this type of situation or how to access javascript functions through HttpClient API.
    Thanks
    Anupam Sarkar

    hi,
    i have the same problem. i want to reach a url that has two parameters sent from a javascript function;
    +function doPost(eventTarget, eventArgument) {+
    +if (!theForm.onsubmit || (theForm.onsubmit() != false)) {+
    theForm._ET.value = eventTarget;
    theForm._EA.value = eventArgument;
    theForm.submit();
    +}+
    i tried to write a java code that appends values wtih namevaluepair and send them to base url with setrequestbody method;
         HttpClient client = new HttpClient();
    +          +
    +     String actionURL = "http://mevzuat.basbakanlik.gov.tr";+
    +          +
    +     PostMethod method = new PostMethod();+
    +          +
    +     NameValuePair[] postData = {+
    new NameValuePair("aspnetForm._ET.value","ctl00$Menu1"),
    new NameValuePair("aspnetForm._EA.value","~/AlfabetikFihristler.aspx"),
    +                         };+
    +               +
    +     method.setPath(actionURL);+
    +     method.setRequestBody(postData);+
    +          +
    +     int status = client.executeMethod(method);+
    +.+
    +.+
    +.+
    this code gives a warning;
    Feb 13, 2008 9:05:09 PM org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
    WARNING: Cookie rejected: "$Version=0; ASP.NET_SessionId=fa4pnl55x3wxy2n2psorpdmu; $Path=/". Illegal path attribute "/". Path of origin: "http://mevzuat.basbakanlik.gov.tr"
    and it does not recognize the parameters that i have sent and gets the base url content only.
    i am very new to this subject and any help that can fix my problem or shows me the way to solve my problem is appreciated.
    thanks...

  • Using Session Variables for User Login - sometimes they don't persist... what am I doing wrong?

    Hi all,
    I'm running a site that requires user login.  I approached the building of this site as almost a complete newb to CF (and dynamic coding in general), and it's been a great learing experience (with lots of help from you guys).
    However, I guess I never learned the correct way to handle a user login.  It seemed to me that I could just test the user-entered credentials against those stored in a database, then set a session variable containg that user's record number.  Then, not only would I have an easy way of knowing who this user was and therefore what info to serve him, but I could test for the existence of a valid login on every page in the protected folder, by adding this code to my application.cfc in that folder:
    <cfset This.Sessionmanagement=true>
    <cfset This.Sessiontimeout="#createtimespan(0,8,0,0)#">
       <cfif NOT isDefined ("session.username") or NOT isDefined ("session.password") or NOT isDefined ("session.storeID")>
         <cflocation url="../index.cfm" addtoken="no">
       </cfif>
    ...and it goes on to run a query and verify that the session.username and session.password match for the store defined by session.storeID.  If not, all session variables are cleared and it bounces you back to the login page.  When the user clicks Logout, all I do is delete all the session variables.
    This seemed to work great for like a year, but lately I've been getting reports that the login doesn't seem to persist for longer than approx. 20 minutes of inactivity.  You can see I specified session variables to remain active for 8 hours (I know that seems like a drastically long login, but it's what's necessary for this application).  I've only gotten this report from a few people, and I myself can't seem to duplicate it... I've tested an inactive login for 45 minutes now and it held.
    SO:  any reason you can think of why session variables would be spontaneously clearing for some people?  Would having your router reset its IP address invalidate the session or something?  Also, the problem seemed to begin appearing after my host upgraded all their servers to CF9... could there be any relation?
    And on a more general note... did I go about this completely the wrong way to begin with?  If so, what's the standard way to manage a login?
    Lots of questions, I know... thanks very much for any answers or suggestions!
    Joe

    Ian,
    Thanks very much - very helpful information.
    Sounds like passing the tokens in every request is probably the way to go for this.  I don't think it's likely that any users will be sharing links, unless they actually intend for the recipient to see their info anyway.
    Is that all I would have to do, is add the tokens to every path?  Would that guarantee that all the session variables would remain valid until timeout or being cleared?
    Again, thanks, you've been really helpful.
    Joe
    On Jun 23, 2010 4:37 PM, Ian Skinner &lt;[email protected]&gt; wrote:
    Unfortunately this is the nature of HTTP web applications.  There is NO state maintained from HTTP request to request.  This is by design in the HTTP protocol specifications.
    ColdFusion provides two methods to circumvent this limitation.  Each method has limitations and caveats.  They both rely on the passing of tokens between the client and the server with every request.  These tokens can be passed as cookies OR URL (GET) variables.  You are using the cookie method, which is the simpler and most common. You may be experiencing the limitation of this method.  If something happens to the cookies the session can be lost.
    You could pass the (CFID &amp; CFTOKEN) OR JESSIONID tokens through the URL query string with every request.  This requires one to add these values to every link, form action, cflocation or other request path in our application.  ColdFusion provides the session.urltoken variable to make this easier to do.  The tokens will be visible to the user.  Also if the links with an individual token is share with other users, via e-mail, chat, social networks, etc and one of these users utilize the link during the life of a session (8 hours apparently in your case).  Then that user will access the session of the original user.
    Cookie session management is by far the most common choice by CF developers.  If these methods do not meet your needs you would need to go beyond the HTTP limitations of web applications.  One might be able to accomplish this with a Flex|Air|Flash applications that can be configured to use a continuous connection to the server.  Thus not suffer the stateless nature of the normal HTTP request-response cycle.
    I do not know if a router resetting would cause cookies to be discarded or otherwise invalidated.  But I would not think it is beyond the relm of possibilities.

  • How to use javascript variable in BSP/ABAP and vice versa

    Hello Experts,
    In IC WEBCLIENT, there is a view.In the view.htm i want to fetch  the screen resolution and as per the resolution i want set the width of that view.
    1, I wrote the below  javascript to fetch the screen resolution.
       Can i use a notmal ABAP variable inside the javascript? and   If i use can i access that variable after the javascript.?
       Can i assign a javascript variable to a nrmal abap variable??
       The code sample  is like :
    Start of javascript
       if (screen,width == 1024 )
         lv_width = 500  "lv_width is an ABAP variable.
      else
        lv_width = 700
    **END OF JAVASCRIPT
       **Now i want to use lv_width  to assign to a table view attribute(Width)
    <crmc: tableview..
                    width = <%= lv_width >
    the code is not giving any error. But the problem is that lv_width is not giving the correct value, its getting initialized to initial value...
    Requesting the experts to please provide some suggestions/solution for the above issue.
    Thanks and Regards
    Sudhansu

    Hello Sudhansu,
    First of all there was a little mistake at my previous answer:
    you got lw_width = 700
    because at Server Side you have following code:
    lw_width = 500.
    lw_width = 700.
    but if you were writing your code like this:
    <%=lw_width %> = 700.
    then you will get the result that I was talking about : 0 = 700
    Sorry for the mistake
    Now for your question:
    if you want to get a value from the server and assign it to JScript variable you should write like this :
    var aaa;
    aaa = <%=lw_width %>;
    this code assign the server variable lw_width value into aaa  JScript varible.
    I'm not sure what exactly you want to do but look at this link:
    http://www.pageresource.com/jscript/jscreen.htm
    to get the idea how to get and use Screen Resolution variables at your JScript code.
    Good luck
    Eli Steklov
    Please Reward Points if it Helped

  • How to use form-login in iPlanet?

    Hi guys:
    I tried to use J2EE form-based login feature to trigger user authentication,
    but I can only specify the login page and the login error page, so how to
    redirector the location after user login successful?
    Thanks

    You need to try to reach a page/servlet/pattern that is protected. Then the j_security_check action in your form-login page will be populated with the relevant parameters. You will be presented with a login page when you try to access the servlet, then you will be redirected to the appropriate protected resource.

  • Question about using constant variables in Forms

    As I am still very new to Forms, please forgive my ignorance if the answer to my question is very simple. I am trying to figure out how to use constant variables within my Forms application. For example, if I want to setup return code constants for the application (mind me, these are examples):
    RC_SUCCESS CONSTANT PLS_INTEGER := 1;
    RC_FAILURE CONSTANT PLS_INTEGER := 0;
    RC_YEAR_DATA_NOT_FOUND := 50;
    Then in a module I created, if I wanted to check the return code against one of the constants I would do:
    DECLARE
    rc PLS_INTEGER;
    BEGIN
    GET_YEAR_DATA('2000', rc);
    IF rc = RC_YEAR_DATA_NOT_FOUND THEN
    -- Do some error handling
    END IF;
    END;
    I know that you can declare constants within individual procedures or packages but I can't see to find information on how to do this globally for the application. I've read about using global variables within Forms but the CHAR data type only and the fact the value can be changed doesn't really fit for this purpose. Am I missing something? Is there a config file or something for the webserver that can be used to set these up??
    Any help would be appreciated.
    Thanks

    To declare constants create a Package-Specification in a pll and deifne all your constants there, something like:
    PACKAGE PK_CONSTANTS IS
      RC_SUCCESS CONSTANT PLS_INTEGER := 1;
      RC_FAILURE CONSTANT PLS_INTEGER := 0;
      RC_YEAR_DATA_NOT_FOUND := 50;
    END;Then attach that pll to all your forms-modules, and use it like
    IF rc = PK_CONSTANTS.RC_YEAR_DATA_NOT_FOUND THEN
    END IF;A word about exceptions or errors: In my eyes its clearer (and in case of exceptions even better) to raise an exception than to hide it behind return-codes.

  • How to pass  JavaScript variable value throuh netui form ??

    Hi All,
    I have reqmnt,where in I need to pass the value from JavaScript function through
    Form submission.
    I could able to pass this through simple HTML form using SIMPLE HTML tags. How
    can i do the same thing using NETUI tag (NETUI form)??
    Can somebody throw some input on this??
    TIA,
    RAM.

    Excellent - Thats what I was also looking.
    RAM.
    Thomas Cook <[email protected]> wrote:
    >
    Here's an example of what I think you're trying to do:
    <netui:html>
    <body>
    <netui:form action="submitIt" tagId="myForm">
    <netui:button value="Submit It" onClick="return setFormValue()"/>
    <script>
    function setFormValue()
    var form = document.getElementById( getNetuiTagName( "myForm",
    this ) );
    var newVal = document.createElement( "input" );
    newVal.type = "hidden";
    newVal.name = "foo";
    newVal.value = "bar";
    form.appendChild( newVal );
    return true;
    </script>
    </netui:form>
    </body>
    </netui:html>
    Thomas
    RAMt wrote:
    Hi All,
    I have reqmnt,where in I need to pass the value from JavaScript functionthrough
    Form submission.
    I could able to pass this through simple HTML form using SIMPLE HTMLtags. How
    can i do the same thing using NETUI tag (NETUI form)??
    Can somebody throw some input on this??
    TIA,
    RAM.
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
    <title></title>
    </head>
    <body>
    Here's an example of what I think you're trying to do:<br>
    <br>
    <tt><nobr><netui:html></nobr><br>
    <nobr>  <body></nobr><br>
    <nobr>    <netui:form action="submitIt" tagId="myForm"></nobr><br>
    <nobr>    <netui:button value="Submit It" onClick="return
    setFormValue()"/></nobr><br>
    <nobr>    <script></nobr><br>
    <nobr>      function setFormValue()</nobr><br>
    <nobr>      {</nobr><br>
    <nobr>          var form
    = document.getElementById( getNetuiTagName(
    "myForm", this ) );</nobr><br>
    <nobr>          var newVal
    = document.createElement( "input" );</nobr><br>
    <nobr>          newVal.type
    = "hidden";</nobr><br>
    <nobr>          newVal.name
    = "foo";</nobr><br>
    <nobr>          newVal.value
    = "bar";</nobr><br>
    <nobr>          form.appendChild(
    newVal );</nobr><br>
    <nobr>          return true;</nobr><br>
    <nobr>      }</nobr><br>
    <nobr>    </script></nobr><br>
    <nobr>    </netui:form></nobr><br>
    <nobr>  </body></nobr><br>
    <nobr></netui:html></nobr></tt><br>
    <br>
    Thomas<br>
    <br>
    RAMt wrote:
    <blockquote cite="[email protected]" type="cite">
    <pre wrap="">Hi All,
    I have reqmnt,where in I need to pass the value from JavaScript function
    through
    Form submission.
    I could able to pass this through simple HTML form using SIMPLE HTML
    tags. How
    can i do the same thing using NETUI tag (NETUI form)??
    Can somebody throw some input on this??
    TIA,
    RAM.
    </pre>
    </blockquote>
    </body>
    </html>

  • Using Javascript With Acrobat Forms

    Hello,
    I have been attempting to use Javascript with forms made using Acrobat X Pro. Particularly, I am attempting to use the Font palette with Text fields as described in http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf .
    One example of this is the Strikethrough property.  TextField1.caption.font.lineThrough = "linethrough" and TextField1.font.lineThrough = "linethrough". I see that "linethrough" is an enumeration (Having values of 0,1, and 2). But I have tried this numerous times, in various ways, and it does not work. I also tried other Font properties and could not get them to work. Is there more setup to this? I am still very much new to developing Forms, and it was frustrating for me to not find a resource that outlined all of the stuff you could do with Forms. My only prior experience with Javascript is for web pages. The pdf I mentioned above seemed promising, but I'm having trouble implementing it.
    I appreciate any help for this!

    For questions about LiveCycle Designer use the forum LiveCycle Designer.

  • Can I use a javascript variable for the ID of a module ?

    I want to use a javascript variable to pull up the related media downloads.
    So instead of using a hard coded
    <div id="media">
      {module_literature,c,45243}
    </div>
    I want to use jQuery to render the right category of media downloads ... Something like:
    <div id="media">
         new text would go here
    </div>
    <script language="javascript">
         var id = 45243
         $('#media').html({module_literature,c,id})
    </script>
    Ive also Tried the following
    <script language="javascript">
        var id = 45243
        var str = '{module_literature,c,'+id+'}"
         $('#media').html(str)
    </script>
    Niether seems to work ?

    Hi Brad
    I want to eventually change the id to a variable that is changed elsewhere on the page via jquery
    But I can seem to get either of the above to work ?
    I seem to get Unexpected token illegal messages when using the above script

  • Without using applets geting the output into a javascript variable

    Hi,
    I'm not using executeCommand applets in my webpage,but with the url
    i'm running the transaction. I'm passing the url to iframe as a <b>src</b> in the same page itself. like
    <b>document.getElementById("<iframe>").src="http://localhost/Lighthammer/Runner?Transaction=<Transaction_Name>&<Input_params>=<value>&OutputParameter=*"</b>. It will take 10 seconds to execute the transaction and load into the iframe.
    So I'm giving the
    <b>SetTimeout("alert(document.getElementById('<iframe>').docuemnt.body.innerHTML",10000);</b>
    In the iframe i'm able to see the output as "<u>oktransaction executed</u>" in <u>xml format</u>.
    But in the alert I'm not able to see the same content. <i>In the alert I'm able to see</i>
    <u><iframe id="<id of iframe>" src="<Which i set in the script>"></iframe></u>
    Help me to get the OutputParameter value into a javascript variable.

    Rakesh,
    A couple of observations:
    1.  Why are you calling Runner directly?  You should be using an XacuteQuery template, and reference "/Lighthammer/Illuminator?QueryTemplate=Folder/TRX" syntax when changing the URL in the iFrame.
    2.  You are also using "localhost" which is not portable and may also be causing your problem since your parent page will be based upon the server path, whereas you are forcing the browser to load localhost content into the iFrame (which unless you are physically sitting on the xMII server itself will never work).
    Regards,
    Jeremy Good

  • How reset Acrobat form field using javascript API

    How reset Acrobat form field using javascript API

    There are several ways:
    resetForm(["Text1"]);
    or
    getField("Text1").value = getField("Text1").defaultValue;
    George

  • Using javascript variable in spry if statement

    is it possible to put a javascript variable in to the spry if
    statement to test?
    like <div spry:if="javascriptvar == {ds_RowNumber}"....
    thanks.

    Hi rogerfreak,
    When the region processes a spry:if, it simply takes the
    value of the spry:if attribute, replaces all of the data references
    in it with real values from the data set and then evals the result
    (executes the string).
    So you can do something like:
    <script>
    var ds1 = new Spry.Data.XMLDataSet("foo.xml", "/foo/bar");
    var gMode = 5;
    function GetMode()
    return gMode;
    </script>
    <div spry:region="ds1">
    <ul spry:if="gMode == 5">
    <li spry:repeat="ds1">{name}</li>
    </ul>
    <div spry:if="gMode == 12" spry:repeatchildren="ds1">
    {name}
    </div>
    </div>
    In the example above the list markup will be written out if
    gMode is 5, but if it is 12, it will write out the div markup.
    You can also call functions:
    <div spry:region="ds1">
    <ul spry:if="GetMode() == 5">
    <li spry:repeat="ds1">{name}</li>
    </ul>
    <div spry:if="GetMode()== 12"
    spry:repeatchildren="ds1">
    {name}
    </div>
    </div>
    --== Kin ==--

Maybe you are looking for

  • How do I remove a credit card number from my Apple ID?

    I am unable to remove my credit card information from my Apple ID. And every time I re enter the card information, it says my payment method was declined. I am unable to download apps or music onto my phone or iPod and it is very frustrating.

  • Is it possible to convert a pdf document to an editable format in pages ?

    I have a 300 page document which is a pdf and rather than retype it in Pages, I would really like to know if there is a way to convert it so I can edit it in Pages. Any advice would be greatly appreciated.  Thanks !

  • Script crashing

    Hello folks, I am running a script from mail.app in the rules section. mail.app Version 3.2 (919/919.2) OSX is Leopard 10.5.2, Every time the script runs mail.app closes with an Ignore relaunch or send dialog. This script runs fine in Tiger. Here is

  • FLV creation

    So Adobe has stopped supporting their own format FLV in Media Encoder now in 2014.  Removal of FLV and F4V export features from Adobe Media Encoder, After Effects, and Premiere Pro http://blogs.adobe.com/aftereffects/2014/06/removal-flv-f4v-swf-expor

  • Open Space as a work center

    Hi Gurus, My client is in fabrication work. Client has a huge open space where they perform the work. Now client  want to do the capacity planning for the open space. Suppose has the space of 10000 sq meter. In that space can produced 3 finished prod