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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Asp.Net Session state issue

Status
Not open for further replies.

jerasi

Programmer
Jun 19, 2000
141
CA
I just deployed a test application to see how the new session state is handled under Asp.Net, and a variable I inserted into the session doesnt seem to be there.
I used: Session.Add("myVariable", Request("myVariable")) 'holds the value 1
When I post the page, I use this if statement to check the session variable:
If Session.Item("myVariable") Is Nothing Then
Response.Redirect("End If

The page always redirects to google, I'm pretty sure web.config is configured correctly (see below), and I got the "ASP.NET State Service" running

Any idea what I'm doing wrong?
Thank you.

jerasi

Web.Config

<sessionState mode=&quot;StateServer&quot; stateConnectionString=&quot;tcpip=127.0.0.1:42424&quot; sqlConnectionString=&quot;data source=127.0.0.1;user id=sa;password=&quot; cookieless=&quot;false&quot; timeout=&quot;30&quot;/>
 
Have you tried..

Dim tryThis As Integer = 1000
Session(&quot;tryThis&quot;) = tryThis

after PostBack refer to session...

If IsNothing Session(&quot;tryThis&quot;) then
Response.Redirect(&quot;End if
 
I just tried it, and it doesnt work.
The session state is working on my development machine but not on the production server. Any ideas?
Thank you.

jerasi
 
Not sure what is going on. I did vpn to work and looked at our web.config file on our production server ....

<sessionState
mode=&quot;InProc&quot;
stateConnectionString=&quot;tcpip=127.0.0.1:42424&quot;
sqlConnectionString=&quot;data source=127.0.0.1;user id=sa;password=&quot;
cookieless=&quot;false&quot;
timeout=&quot;20&quot;
/>

I sometimes will recreate an empty obj and set it to a session ..

Dim allAccounts as new Accounts()
allAccounts = Session(&quot;allAccounts&quot;) ..allAccounts was a collection created and set in if not postback

If Not IsNothing(allAccounts) Then
' blah blah blah
End If

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top