Session Time Out Problem

Posted by saisuresh074-17816 under ASP.NET on 9/11/2012 | Points: 10 | Views : 1244 | Status : [Member] | Replies : 6
I hav a login page and my logout button is in another page..I am carrying sessions from login page to logout page..But thing is my session is expiring
after 20 minutes...But i want it to not to end and it should remain for nearly 10 hours..So guys plz help me in coding this....




Responses

Posted by: Sujeet on: 9/11/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Friends

Instead of relying on default Session mechanism given by ASP.NET . You use class property. lets Make a Code sample

Class SessionIssue
{

static string Sess="";
Public string Sess1
{
get;
set;
}


}
// End of class in App_code

in Default.aspx
------------------------------------
SessionIssue s= new SessionIssue();
s.Sess1="Your Values" // you keeping value in property that will be accessed wherever you want


----------------------------------------------------------------
In Default1.aspx
------------------------------------
SessionIssue ss= new SessionIssue();
string sessionValue=ss.Sess1; // you accessing session that was set in other page

if you have any problem then let me know at kumar21sujeet@gmail.com with subject line "Dotnetfunda Question";

Thanks sujeet kumar
More details you can visit my blog at
http://sujeet21.wordpress.com/


Sujeet Kumar
Software Developer
MCTS, MCPD
http://sujeet21.wordpress.com/

saisuresh074-17816, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vasanthmvp on: 9/11/2012 [Member] Starter | Points: 25

Up
0
Down
HI, you can explicitly mention the session timeout time like,

Session["Data"] = values;
Session.Timeout = 600; // (10*60 = 600 min)

Regards,

Awesome Coding !! :)

saisuresh074-17816, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 9/11/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Add this code inside your web.config

<system.web>
<compilation debug="true"/>
<authentication mode="Forms"/>
<sessionState mode="InProc" cookieless="false" timeout="60">
</sessionState>
</system.web>

you can also set session timeout on IIS server. Refer this url
http://support.yessoftware.com/kb_article.asp?article_id=74
http://forums.asp.net/t/1283350.aspx

saisuresh074-17816, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: saisuresh074-17816 on: 9/11/2012 [Member] Starter | Points: 25

Up
0
Down
@ Ranjeet_8: I have tried in web config as u mentioned...its not working its again expiring after 20min.....That can be done in IIS?..guys how to set in IIS..will it work?



saisuresh074-17816, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 9/11/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
@Saisuresh074@Gmail.Com

please check my above post.
your will find the url.
Live Demo :
http://support.yessoftware.com/kb_article.asp?article_id=74

saisuresh074-17816, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: saisuresh074-17816 on: 9/11/2012 [Member] Starter | Points: 25

Up
0
Down
thanks a lot..hope it ll work..

saisuresh074-17816, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response