Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Strange Session Restart

Thread Tools

Strange Session Restart

Posts: n/a
I am using form authentication and InProc cookieless session. The
strange thing is that when an authenticated user try to navigate to any
page that is in subfolder of the application root, the session is
restarted and new session id is generated. Thus the user would never
be able to access those pages because each page's InitializeComponent()
checks if (Session.Keys.Count == 0). If yes, then server transfer the
request to login.aspx page again.
Does anyone know why the session is restarted? Thanks. The following
are snippets of the web.config and login.aspx:

<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="Off" defaultRedirect="/accessDenied.aspx"/>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" cookieless="true" timeout="20" />

<authentication mode="Forms">
<credentials passwordFormat = "SHA1"/>

<deny users="?"/>


<!-- page that does not require login -->
<location path="main.aspx">
<allow users="?"/>

<!-- page that does not require login -->
<location path="_Net/forms/StatusChange.aspx">
<allow users="?"/>

private void btnLogin_Click(object sender, System.EventArgs e)
if (Page.IsValid)
string strAccountName = Server.HtmlEncode(txtAccount.Text);
string strPassword = Server.HtmlEncode(txtPassword.Text);

oUserCredential = new User();
if(oUserCredential.UserCredential(strAccountName, strPassword))
Session["Account"] = oUserCredential.Account;
Session["UserID"] = oUserCredential.UserId;
Session["UserOrganization"] = oUserCredential.Organization;
Session["FirstName"] = oUserCredential.FirstName;
Session["LastName"] = oUserCredential.LastName;
Session["UserEmail"] = oUserCredential.Email;
Session["UserRole"] = oUserCredential.Role;
Session["SrmRole"] = oUserCredential.SrmRole;

// Return to the originally requested URL.

System.Web.Security.FormsAuthentication.RedirectFr omLoginPage(strAccountName,PersistCookie.Checked);

Msg.Text = "Invalid Credentials: Please try again. <br/>";

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Restart Now - Restart Later another MickG Computer Support 14 04-24-2006 02:55 AM
XP restart vs msconfig restart Opsimath Computer Support 4 07-31-2005 02:58 PM
History disappeared in middle of session, Firefox would not restart after closed Jim Firefox 1 05-30-2005 04:47 PM
Re: Strange bug: application dies (partially) after restart Bruno Jouhier [MVP] ASP .Net 5 04-07-2004 02:05 AM
HELP! How to handle Session Restart on Logon Harry Simpson ASP .Net 6 08-14-2003 09:16 PM