RE: Accessing Session information from Javascript

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Leon Welicki (LeonWelicki_at_discussions.microsoft.com)
Date: 10/08/04


Date: Fri, 8 Oct 2004 13:03:03 -0700

Another option could be to have a hidden iframe and navigate to a page (via
javascript) that returns the session variable value (for instance, something
getSessionValue.aspx?var=varName).

The getSessionValue.aspx only needs to do the something like
Response.Write(Session(Request.QueryString["var"]))

Then, you can access via Javascript to inner value of that div

This option gives you session information at the moment, but you have to
deal with syncronization issues and javascript client programing.

Regards,
Leon

"Jeronimo Bertran" wrote:

> ok, now... my problem is that the value that needs to be saved is generated
> inside a page that lies inside a frame of the form that needs to know the
> value.... how can I save the value to a hidden input field in the main
> form? Or access the hidden input field in the child frame from my main
> form?
>
>
> "=?Utf-8?B?U2F1cmFiaCBOYW5kdQ==?="
> <SaurabhNandu@discussions.microsoft.com> wrote in
> news:82524D53-58A8-43FF-A20A-0B1E5D306220@microsoft.com:
>
> > Hi,
> >
> > Client-Side scripts cannot access Server-Side variables! Hence you
> > cannot access the server-side session object from your javascript.
> >
> > I'd suggest that instead of savig that value to a session save it to a
> > hidden input field, so that the JavaScript can read the value from it.
> >
>
>



Relevant Pages

  • RE: [PHP] Saving css state in javascript and passing to php via form submit
    ... to php via form submit ... Now i'm also using javascript to hide show blocks of divs ... Ok, i can put the data in the session variable, but i can ... Maybe you could also use AJAX instead of submitting forms the ...
    (php.general)
  • Re: browser.history and log file
    ... >> webserver and want to know from where users are coming from. ... >> Understand I want the last surfer's browser visited url. ... > First you need to set up a little JavaScript to get the variable of the URL ... you could also combine the 2 solution, i.e. use session if a previous ...
    (comp.lang.php)
  • Re: Windows app or ASP.NET ?
    ... session, web security (although several years ago I worked with web project ... using Javascript and HTML). ... through understanding of Javascript, CSS, HTMl, XHTML, sessions, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Safari interprets submit() as method POST
    ... There is a small bit of javascript which, ... stored values for that session using a session ID variable named, ... Even though the form's method is set to "GET", Safari insists on ... To resolve this in the browser, you can create a submit button in the ...
    (comp.lang.php)
  • How well do sessions scale?
    ... The Javascript then calls main.php, ... a visitor's profile in $_SESSION elements. ... on the practical limits of sessions. ...
    (comp.lang.php)