Click here to Skip to main content
15,943,233 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
below is the code that I have used for the web config file and Global.asx file code, my session gets timeout very quickly it not working properly.
I have used a dedicated server for hosting my web application. Plz help

What I have tried:

// Web Config setting

<compilation debug="false" targetframework="4.5.2">
<add assembly="System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089">

<authentication mode="Forms">
<forms loginurl="#" protection="All" timeout="60" requiressl="false" slidingexpiration="true" cookieless="UseDeviceProfile" enablecrossappredirects="false">

<sessionstate timeout="60" mode="InProc" cookieless="false" stateconnectionstring="tcpip=" statenetworktimeout="60" sqlconnectionstring="data source=;Integrated Security=SSPI">
<httpruntime executiontimeout="3600" maxrequestlength="1048576" requestpathinvalidcharacters="" requestvalidationmode="2.0">
<pages buffer="true" validaterequest="false" enableeventvalidation="false" viewstateencryptionmode="Never" enableviewstatemac="false" maintainscrollpositiononpostback="true" controlrenderingcompatibilityversion="3.5" clientidmode="AutoID">

// Global.asax File code for session

void Session_Start(object sender, EventArgs e)
// Code that runs when a new session is started
//Session.Timeout = 60;

if (Session.IsNewSession)
//do things that need to happen
//when a new session starts.
Session.Timeout = 60;

Updated 28-Jul-22 21:15pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900