By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,934 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,934 IT Pros & Developers. It's quick & easy.

Session State not maintained asp.net 2.0

P: n/a
I must be doing something fundamentally wrong here. This is what I have in
web.config:

<sessionState cookieName="SOMENAME" mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;user id=sa;password="
cookieless="false" timeout="15" />
<globalization requestEncoding="ISO-8859-1"
responseEncoding="ISO-8859-1" />
<pages theme="DefaultTheme" enableSessionState="true"
enableViewState="true" enableViewStateMac="true" validateRequest="true" />

I also set the EnableSessionState on the pages explicitly. In one of the
pages I have this code:

protected void Page_Load(object sender, EventArgs e)
{
if (Session["AAAAA"] == null)
{
Session["AAAAA"] = 0;
}
else
{
Session["AAAAA"] = (int)Session["AAAAA"] + 1;
}
}

If I keep refreshing this page, the Session ID is always different and the
Session.IsNewSession is always true. Even though I can see that the value of
0 is set, on every request the session is regenerated... Why would that
happen?

Thank you,

Iulian
--
Regards,

Iulian
Mar 27 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Well I guess you need to add the GLOBAL.ASAX file in the root directory
of your website.
This is not automatocally added noe in VS.Net 2005 and so you need to
add this manually.

Add New Item --> Global.asax

You don't need to wirte any code. But I hope this should help you out.

Vivek N
MCAD

Mar 27 '06 #2

P: n/a
Ok, I solved it, apparently this was causing the problem:

<sessionState [...] />

Once I removed it from web.config it started to work. This was a
reminescence of the asp 1.1 application and I assume it conflicts with 2.0...

--
Regards,

Iulian
"Iulian" wrote:
I must be doing something fundamentally wrong here. This is what I have in
web.config:

<sessionState cookieName="SOMENAME" mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;user id=sa;password="
cookieless="false" timeout="15" />
<globalization requestEncoding="ISO-8859-1"
responseEncoding="ISO-8859-1" />
<pages theme="DefaultTheme" enableSessionState="true"
enableViewState="true" enableViewStateMac="true" validateRequest="true" />

I also set the EnableSessionState on the pages explicitly. In one of the
pages I have this code:

protected void Page_Load(object sender, EventArgs e)
{
if (Session["AAAAA"] == null)
{
Session["AAAAA"] = 0;
}
else
{
Session["AAAAA"] = (int)Session["AAAAA"] + 1;
}
}

If I keep refreshing this page, the Session ID is always different and the
Session.IsNewSession is always true. Even though I can see that the value of
0 is set, on every request the session is regenerated... Why would that
happen?

Thank you,

Iulian
--
Regards,

Iulian

Mar 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.