•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,596 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,706 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 7257 | Replies: 1
![]() |
•
•
Join Date: Oct 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
urgent: session timeout occurs unexpectedly(given both web.config & global.asax code)
#1
Oct 10th, 2005
I am doing a website with asp.net. i have used session variable in my GLOBAL.ASAX file. the code is given below:
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Session.Timeout = 100
Session("Loggedin") = "No"
End Sub
Sub Session_End(Sender As Object, E As EventArgs)
' Code that runs when a session ends
Session.Abandon()
Response.Redirect("index.aspx")
End Sub
----------------------------------------------------------
And in WEB.CONFIG i have used the following information inside <system.web> tag :
<sessionState mode="InProc"
cookieless="false"
timeout="100"/>
<pages buffer="false"
enableSessionState="true"
smartNavigation="false"
autoEventWireup="true"
validateRequest="false"
enableViewStateMac = "false"
enableViewState="true"/>
----------------------------------
I am storing the user details in sql database.
In the login page when theuser enter the usernam and pwd i check with the backend for valid username and pwd. Then i assign
session variable values if valid else i dont let it.
And then in every page i check if session variable is valid if not i do a server.transfer("index.aspx") to the login page.
Here, index.aspx is my login page.
This below code is included in every page after a succesful login to check for valid user. other than that 8i have not put
anyother check to find out valid user.
----------
Sub Page_Load(Sender As Object, E As EventArgs)
if Session("Loggedin") = "No" then
server.transfer("index.aspx")
end if
end sub
----------
Even after using these things when i login suddenly after a minute i am logged out though i am adding/deleting/viewing
records at the moment.
Please please tell me where i am going wrong. I have to give this project to my boss soon and i am stuck here since i am not
able find out the problem why the session expires and i am logged out and send back to the login page.
Seema
(Mail ID: gaur.seema at rediffmail.com)
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Session.Timeout = 100
Session("Loggedin") = "No"
End Sub
Sub Session_End(Sender As Object, E As EventArgs)
' Code that runs when a session ends
Session.Abandon()
Response.Redirect("index.aspx")
End Sub
----------------------------------------------------------
And in WEB.CONFIG i have used the following information inside <system.web> tag :
<sessionState mode="InProc"
cookieless="false"
timeout="100"/>
<pages buffer="false"
enableSessionState="true"
smartNavigation="false"
autoEventWireup="true"
validateRequest="false"
enableViewStateMac = "false"
enableViewState="true"/>
----------------------------------
I am storing the user details in sql database.
In the login page when theuser enter the usernam and pwd i check with the backend for valid username and pwd. Then i assign
session variable values if valid else i dont let it.
And then in every page i check if session variable is valid if not i do a server.transfer("index.aspx") to the login page.
Here, index.aspx is my login page.
This below code is included in every page after a succesful login to check for valid user. other than that 8i have not put
anyother check to find out valid user.
----------
Sub Page_Load(Sender As Object, E As EventArgs)
if Session("Loggedin") = "No" then
server.transfer("index.aspx")
end if
end sub
----------
Even after using these things when i login suddenly after a minute i am logged out though i am adding/deleting/viewing
records at the moment.
Please please tell me where i am going wrong. I have to give this project to my boss soon and i am stuck here since i am not
able find out the problem why the session expires and i am logged out and send back to the login page.
Seema
(Mail ID: gaur.seema at rediffmail.com)
•
•
Join Date: Nov 2005
Location: Mountain View, CA
Posts: 47
Reputation:
Rep Power: 3
Solved Threads: 1
Re: urgent: session timeout occurs unexpectedly(given both web.config & global.asax code)
#2
Nov 9th, 2005
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
advertising ajax asp blog browser browsing community data design development devices dom domains feed firefox google html india intel internet legal linux marketing microsoft mobile applications mozilla multimedia news office php privacy reader report research search security software sql sun video w3c weather web web development wiki xml xoap yahoo youtube
- database string in web.config not working (ASP.NET)
- Redirect to loginpage on Session timeout (C#)
- Difference between Web.Config and Machine.Config (C#)
- wat is web.config (ASP)
Other Threads in the ASP.NET Forum
- Previous Thread: "Operation is not allowed when the object is closed" error
- Next Thread: Receiving error in Visual Studio.Net when compile with F5


,
Linear Mode