Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble Updating Session Variable

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
US
Hi,

I'm trying to change a session variable value to a local variable on my script (Page1.asp),
and then access that changed session variable on another page (Page2.asp).

Currently, I have the GLOBAL.ASA file on my website's root directory.

The GLOBAL.ASA looks like the following:


<script language=&quot;Vbscript&quot; Runat=Server>
Sub Session_OnStart

Session(&quot;ufilename&quot;) = &quot;initial filename&quot;

End Sub
</script>


PAGE1.ASP Script:


<% Response.Buffer = true
userfile = &quot;file123&quot;
%>

<html>...
<body>
<%
'modify existing session variable
Session(&quot;ufilename&quot;) = userfile

%>

<% Response.Clear
Response.Redirect &quot;Page2.ASP&quot;
%>
</body>
</html>


PAGE2.ASP Script:



<html>...

<body>

The user selected filename is <%=Session(&quot;ufilename&quot;)%>
</body>
</html>


Browser output is as follows:

The user selected initial filename


I want it to say: The user selected file123


It almost seems like the session var &quot;ufilename&quot; isn't getting updated in Page1.ASP, but if
I do a screen output, it is.

Please let me know where I'm going wrong. Also, how do I make sure my cookies are enabled?
I'm on an NT workstation and I tried to find the setting in Tools / Internet Options on my
browser, but couldn't see it.

Thanks in advance,
scripter73


 
Internet Options --> Security --> Default Settings

Cookies are in there somewhere --

As far as setting the variable in your global.asa file -- there's no need to do that -- just take that out of the global.asa file -- and leave it as whatever it was by default (usually some comments and such) and see if that clears it up --

Set the variable solely with your session(&quot;varName&quot;) = whatever statements

:)
Paul Prewett
 
Fixed it!

My security settings were too high on my browser which disabled the cookies. I found them on Tools / Internet Options/ Security tab, and had to move the lever bar from &quot;High&quot; to &quot;Medium&quot; settings, and the session variable popped right up!

Thanks for your help.
scripter73
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top