I am running a discussion website. The problem that is coming is that after sometime session automatically expires. I am hosting my website on a shared server and doesn't have access to the settings of extending expiry time in IIS. So is there any way I can do that using web.config?
And also I enabled basic authentication on the server and using default authentication in my website, means I didn't gave any authentication mode in configuration file. So are they same?
Yes, this is possible:
<configuration>
<system.web>
<sessionState timeout="x" />
<system.web>
</configuration>
Where x is the desired session timeout in minutes.
You can manage session timeout using web.config
Sessionstate timeout property is mentioned in minutes.
In webconfig file...
<system.web>
<sessionState timeout="1440"></sessionState>
</system.web>
Related
I have two ASP.net MVC applications say a.xyz.com/Customer and a.xyz.com/CustomerTest.
I have implemented cookie-based FormsAuthentication. Name of Auth cookie (AUTH and AUTHTEST) is different in both the Applications. Problem is that when I browse the applications in same browser, Session Cookies are available in both the apps. Also when I Abandon session in one application, second application's session abandons as well.
Both applications are running under same app pool. I cannot change the app Pool as they are having rewrite rules also which will not be available if I change the app pool.
I don't want to share the session between these two applications.
Please let me know if it is possible and How?
It is done.
I have changed the session cookie name of both the Applications in sessionState.
<sessionState mode="InProc" cookieless="false" timeout="60" cookieName="PRODSession" />
<sessionState mode="InProc" cookieless="false" timeout="60" cookieName="TestSession" />
I have made a web application which uses user authentication and if user is authenticated user then i store it in Session like below.
Session("uid") = txtUid.text
But after 2-3 minutes Session is automatically cleared.
increase your session time in Web.config
<system.web>
<sessionState timeout="260" />
</system.web>
2 - 3 minutes?
it means that you are not sure how long it takes for the session to close.
from here i can assume that you are using internet explorer?
internet explorer has a known issue with asp.net, if you have an underscore in your virtual path like
www.mySite.com/some_test_site.aspx
so i bet you have a scenario like this.
in any case, you can add the following line to your web.config to keep vars for 60 minutes:
<sessionState mode="InProc" timeout="60"/>
it goes under:
<configuration>
<system.web>
You can set the session state of your web application in web.config. Add this code in the Configuration section of your web.config.
<configuration>
<system.web>
...
<sessionState timeout="20" />
...
</system.web>
</configuration>
I want to set timeout for my web application for 12 hours.
I have done setting in web.config file as:
<system.web>
<sessionState timeout="720" />
</system.web>
As suggested in the following post:
I came to know that the Application Pool recycles in every 20 minutes (if the pool is ideal).
And I also checked for changing the application pool time out using one question about application pool timeout setting
But still the session time-out is not set to 720 minutes. Do I need to change machine.config file for changing the session time out.
But I think the properties of machine.config file should be overriden by web.config file.
Kindly provide me some idea.
You can try out WMI(Windows Management Instrumentation) script it can help you.You need to have sufficient priveleges to implement the Script.
follwing are the links you can check to get more information.
http://bendera.blogspot.in/2010/12/configuring-ica-rdp-timeout-values.html
http://technet.microsoft.com/en-us/library/cc771956%28v=ws.10%29.aspx
You should set all following:
Application Pool / Advanced Settings. There the option Idle Timeout should be set in minutes.
Then within the web.config file in system.web section you should also set the Authentication/Forms, SessionState and RoleManager timeouts, if applicable.
<authentication mode="Forms"><forms loginUrl="~/default.aspx" name=".ASPXFORMSAUTH" timeout="120" /></authentication>
<sessionState cookieless="AutoDetect" cookieName="TYS_ADMIN_SessionId" timeout="120" />
<roleManager ... cookieTimeout="120" defaultProvider="GMRoleProvider" enabled="true">...</roleManager>
So we have been stuck on a connection timeout issue and we are lost.
All pages on this asp.net web application times out after exactly 2 minutes.
Saying:
connection timed out
description: connection timed out
All articles on the internet suggest it is the asp.net web config setting "executionTimeout". (Here is ours)
<httpRuntime executionTimeout="3600" requestValidationMode="2.0" maxRequestLength="15360" />
But obviously ours is set to way above 2 mins. A colleague of mine also fiddle with the iis settings without success.
Any suggestions?
EDIT: This does not happen on debug at all, which makes me lean towards it being an IIS issue.
EDIT: We don't believe it to be an asp.net session issue since we are still logged in and can browse to other secure pages after this happens
Resolved: So after some more investigation we discovered that the timeout issue was just from when accessing the website from within our intranet. Apparently we have some daemon software (Websense) running on the network that was the root of all this evil.
The above you mentioned should work, Look for the following in your web.config file (maybe its a issue of session timeout):
<system.web>
<authentication mode="Forms">
<forms timeout="20"/>
</authentication>
<sessionState timeout="20" />
</system.web>
Increase the timeout time you are using.
Hope this helps.
Anyone have any ideas why a servers InProc session state would not be working? Is there a manual reset for it, or a way to check?
Thanks
Session mode is InProc, timeout is 25 minutes.
At this time I'm unsure if the Session object is null, or if the session object is empty and cannot be accessed.
I'm thinking it could be a cookie issue, or it could be that Application_Start doesn't fire properly. What else could it be? IIS settings?
I know this post is old, but I hope this will help someone.
Mine didn't work and I found out that I needed to add httpModules to web.config file.
Web.config:
<sessionState mode="InProc" cookieless="false" timeout="20"
sqlConnectionString="YourConnectionString">
</sessionState>
<httpModules>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</httpModules>
Make sure you aren't setting Session variables in your Application_Start event. That is what the Session_Start is for.
Also, is your application pre-compiled? Check this KB article if so.
Reset Options:
Run IISReset
Restart the World Wide Web
Publishing(W3SVC) service.
Manually recycle the App Pool in IIS