SessionState

K

Kenny

Hi ,

I have created two Web Application - WebApplication1 and WebApplication2 in
same machine for testing purpose.
e.g
http://localhost/WebApplication1.aspx
http://localhost/WebApplication2.aspx

I have this setup for both WebApplication's Web.Config
<sessionState mode="SQLServer" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1; integrated security=true"
cookieless="true" timeout="20" />

ASP.NET State Service - Started

First, I created a Session Variable during the PageLoad e.g.
Session("Testing") = "This is for testing purpose"
Once I click a a button which
Response.Redirect("http://localhost/WebApplication2.aspx")
In WebApplication2, I am not able to retrieve the value of the Session e.g.
Response.Write(Session("Testing")). Why?

in SQL Server, since I am using the InstallPersistSqlState.sql so that I can
have the Session value store in the table for testing purpose. I found out
that the first Session created when PageLoad in WebApplication1, once I
click the button and redirect to WebApplication2, another new session
created.

Please help ....

Thanks,
Kenny
 
C

Cowboy \(Gregory A. Beamer\)

Make sure both applications have the same machine key settings and make sure
the cookie name is the same.

Set up in web.config:
---------------------
<authentication mode="Forms">
<forms name="{CookieNameHere}" path="/"
loginUrl="login.aspx" protection="All" timeout="10" />
</authentication>

<machineKey
validationKey="{ValidationKey}"
decryptionKey="{DecryptKey}"
validation="3DES"
/>

If you leave at default, each server will create its own key. NOTE: You
cannot share session variables across apps (or at least I know of nobody who
has found a way), but you can use the session for a single sign on, as the
session ID will be the same.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
K

Kenny

Hi,

Is it very important to put the authentication mode?

This is my test scenario:
http://192.168.0.100/Test/WebForm1.aspx
http://192.168.0.100/Test/WebForm2.aspx

http://192.168.0.111/Test/WebForm1.aspx

both WebForm1.aspx will create a Session variable with value

http://192.168.0.100/Test/WebForm1.aspx have a button to load the
WebForm2.aspx and display the Session value

http://192.168.0.111/Test/WebForm1.aspx have a button to redirect to
http://192.168.0.100/Test/WebForm2.aspx and display the Session value

both have the same Web.Config

<sessionState mode="StateServer"
stateConnectionString="tcpip=192.168.0.100:42424" timeout="240" />
<machineKey
validationKey="37429795AA5F554C0DD89D815E3A428C865046C666BC91798F52F31C24E6C
D231756FAE36890A0C5401B907CC887558C2838C21F8696D686A83EC65FF0E74DFD"
decryptionKey="32FD4B2E0C6D6F08E64B0A15CE5E05D660362A9A549D7F2C"
validation="3DES" />

both ASP.NET State Service started


Any idea why I still not able to retrieve the Session Value???

Thank you.
Kenny
 
K

Kenny

Even though I added this ... but still no able to retrieve the Session
Value.

<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="/WebForm1.aspx" protection="All"
timeout="240" />
</authentication>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top