dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online Membersnaveensanagasetti
Sunil Jas
penchala
Danasegarane.A
Pawan Awasthi
Padma
sharmila
Ranipriya
malika
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » ASP.NET »

Extend Session Timeout


Posted Date: 30 Jul 2012      Posted By:: rohit singh negi     Member Level: Gold    Member Rank: 856     Points: 5   Responses: 3



Hi ,

How to Extend Session Timeout through javascript?

string script = "window.setInterval(\"alert('Session has been idle over its time limit.Press any key now to conitnue session.');\", " + (Session.Timeout - 5) * 60000 + ")";

this.Page.ClientScript.RegisterStartupScript(this.GetType(), "SessionManager", "<script language=\"javascript\">" + script + "</script>");



i using above code for given alert before session timeout but i need to increase session also.

Please help.

Thanks
Rohit Negi




Responses

#682409    Author: Danasegarane.A Online     Member Level: Gold      Member Rank: 65     Date: 30/Jul/2012   Rating: 2 out of 52 out of 5     Points: 3

The default session time values for asp.net Pages is 20 minute. If you want to increase the session time out value for particular website then you do this in the web.config file of the website

<configuration>
<system.web>
<sessionState mode="InProc"
cookieless="true"
timeout="40"/>
</sessionState>
</system.web>
</configuration>


The above sets the session timeout to 40 minutes

Read the MSDN for more about session timeout
http://msdn.microsoft.com/en-us/library/ms178581.aspx
http://msdn.microsoft.com/en-us/library/h6bb9cz9%28v=vs.71%29.aspx

Thanks & Regards,
Danasegarane Arunachalam

http://www.techreceipe.com/



 
#682454    Author: Ajatshatru Upadhyay      Member Level: Gold      Member Rank: 19     Date: 30/Jul/2012   Rating: 2 out of 52 out of 5     Points: 4

Hi,

You can handle it in JavaScript only through below code


<script type="text/javascript">
var sessionTimeout = 20;
var remainingTime;
remainingTime = setInterval('setRemainingTime()', 60000);


function setRemainingTime() {
sessionTimeout--;
if (sessionTimeout <= 5) {
var result = confirm("You session is about to expire in " + sessionTimeout + " menutes! Press OK to increase session time");
if (result) {
__doPostBack();
}
}
}
</script>


In the above code, session timeout is set to 20 minutes. Before 5 minutes of session timeout, a confirm window is getting fired and if user clicks "OK" then the page is post backed using "__doPostback" so that session time can be initialized.

Hope it'll help you.
Regards
Ajatshatru



 
#682502    Author: Paritosh Mohapatra      Member Level: Diamond      Member Rank: 6     Date: 30/Jul/2012   Rating: 2 out of 52 out of 5     Points: 4

Add the following element in web.config:


<authentication mode="Forms">
<forms loginUrl="Login.aspx" protection="All" timeout="144000">
</forms>
</authentication>


If the application is hosted in IIS, then follow these steps:

1) Go to Control Panel -> Administrative Tools -> Inserter Information Services
2) Expand Default Web Site
3) Right Click on your Web Site -> Proerties
4) In the Web Site Properties dialog box go to ASP.Net tab
5) Click on Edit Configuration... button
6) In the ASP.Net Configuration Setting dialog box go ot State Management Tab
7) Increase the Session timeout (minutes)


Thanks & Regards
Paritosh Mohapatra
Microsoft MVP (ASP.Net/IIS)
DotNetSpider MVM






 
Post Reply
You must Sign In to post a response.

Next : OOPS concepts doubt regarding in functions
Previous : How to go to db when values are given in textbox without any button click?
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.