session expiration to Store Session Expiration Time in Database

Hi Friends

      i have requirement  for Session expiration. I am using the Form authentication. When user login to application the user  login time maintained in Database in table.When user Session is expired i want to update the record of the user in the database.How to do this.

 

Thank in Advance

 

0
ncsubbu
4/9/2009 9:12:20 AM
asp.net.state-management 8807 articles. 0 followers. Follow

3 Replies
1479 Views

Similar Articles

[PageSpeed] 25
Get it on Google Play
Get it on Apple App Store

 Use session_end event in Global.asax


Cheers,
Rahul Soni

Premier Field Engineer - Microsoft
www.dotnetscraps.com

Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.

0
RahulSoni
4/9/2009 12:14:40 PM

RahulSoni:


 Use session_end event in Global.asax


Hi Rahul,

It won't work because in order Session_End to be fired, session state has to exist first.

ncsubbu:

Hi Friends

      i have requirement  for Session expiration. I am using the Form authentication. When user login to application the user  login time maintained in Database in table.When user Session is expired i want to update the record of the user in the database.How to do this.

 

Thank in Advance

 

 

 

ncsubbu

You can't achieve this because if user is inactive and no postback is happening, asp.net can't find itself session is expired. It needs to postback the page to find whether session expired or not.


Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
4/11/2009 4:58:37 AM

 use these two events in global while initiating new session and expiration..

 

 void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started

      //and store and save it in DB
    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

        //update database
    }
  
Muhammad Shoaib
Human Knowledge belong to the World!
0
SaXXXoN
4/11/2009 5:05:31 AM
Reply:

Similar Artilces:

The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increas
Hi.. I am making a mobile application using .net framework 2.0. My Application has  web farm scenario so for state management  I am using Sateserver in my application. My application runs fine if I dont use web farm scenario But in case of web farm scenario it is giving me error "The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit."   &...

"The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increa
Hi.. I am making a mobile application using .net framework 2.0. My Application has web farm scenario so for state management I am using Sateserver in my application. My application runs fine if I dont use web farm scenario But in case of web farm scenario it is giving me error "The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit." I am not getting why this error is coming ..Though I already h...

Time out session expired on new session
After updating to Intraweb XII (12.2.28) I am noticing some odd behavior. I started a new session and eventually the session expired. I get the usual session expired page and move on. No problem there. I close the session and even restart the Intraweb application, which is being run as a service. When I next access the service I get the session expired page. It seems to think that I am accessing the old session even after the application has been killed and restarted. ...

Session Time Out Not expiring session value as using update panel
Hi all, I have a page test.aspx. I am using update panel. At the Page load I am having this code:  Context.Response.Expires = 0 Context.Response.Cache.SetNoStore() Context.Response.AppendHeader("Pragma", "no-cache") Context.Response.AppendHeader("Refresh", Convert.ToString(Session.Timeout * 60) & "; URL=../Main/NewWelcome.aspx")  Now after 60 sec it is going to the NewWelcome.aspx but the session till have value as I clicked a button which was inside the update panel. How to resolve my problem? Thanks for any help. Have a nice day ...

Session expire before session timeout
Hi All ASP.Net Users, I am making an application, and using session variable. I had define session timeout default 20min, and it is define in iis as 20min also. Now issue is, session is getting expire before 20min. I had tried all means to find out, but not getting any clues, can anyone tell me what may be the problem, Secondly, is it possible, to re initialise the session time out if there is any events fired on the page, so that user don't have to login every time,or get the error page.   AnujAnuj are you using session multiple times in your page life cycle.. pls avoid it a...

Session expiring before authentication expires
I seem to be running into a problem where my session variables expire before the user's authentication expires, even though I believe that I am setting the session expiration to be greater than the authentication expiration. Here's how I authenticate users (I am using role-based authentication): FormsAuthentication.Initialize() Dim ticket As FormsAuthenticationTicket Dim hash As String Dim cookie As HttpCookie If CStr(Session("UserType")) = "Admin" Then ticket = New FormsAuthenticationTicket(1, "MM_auth", DateTi...

session states expiring
  When my Session variables expire, I'd like to reset everything and go back to default.aspx. Whats the easiest way to do this? have a look here http://articles.techrepublic.com.com/5100-10878_11-5771721.html Session_End: Fired when a user's session times out, ends, or they leave the application Web site, this means you can no longer referance them, so tring to redirect them will not work.    Liam Mcmullen Hi you can cancel current session by calling HttpSession.Abandon() method. and be careful End event is supported only when the Session mode is ...

session variable cleared before session expires
I have web site developed in ASP.NET & c#. The problem is the session variables are cleared before the session expires. All the session variables are cleared before the session_end event fires. Please suggest probable reason for that. thanks Jog...

How can we enforce server to open a confirm pop up window just 2 min before before expiration of session of a user ,if user select "EXtend" session time shall increment
 How can we enforce server to open a confirm pop up window just 4 min before before expiration of session of a user Like : Your session is about to expire do you want to extend? OK--||---No If user select "OK" session time shall incrementif user select "NO" session shall expire  NOTE: POP up shold open from server not using  from with in the window thanks  Have you investigated using the ajax timer control?  ...

Session Expiry – the session expired after a number of hours of inactivity, although Session Expiry was set to 24 hours
Hi,  I had created a web application where Session expiry was set to 2,000 minutes in IIS. in web config i had given like this but MY web application was left logged in at 18:00 15th Oct, but on the following day 08:30 16th Oct, the session expired as soon as MY web application was used. It was also noted that during the day, MY web application occasionally got session expiry when it was constantly being used.Does the session expiry need to be set up anywhere else? There are no Error logs created. Will you please help me to resolve this issue. i expect your reply soon . With Thanks ...

Session Expiring Unexpectedly
Hi all, I have a website hosted in a shared webserver. The problem iam facing is that the sessions get expired unexpectedly which results in the logging out of the user. The problem does not happen when I run the application locally in my system. On contacting my vendor he suggested that "supported method for sessions are extending in cookies.." Please help, Regards Callingbells Team Raj Kiran S------------Chennai, India Did you check Session Timeout in IIS? Yes, Thats set to 20 mins (default). Raj Kiran S------------Chennai, India...

If session expires, show a session error page.
Hello, can somebody tell me how can I Make my users see a page  if the session timesout, or if the session is null?  MCPD ENTERPRISE APPLICATION DEVELOPER Check if the session is null and then redirect the page to itself by clearing the response and adding the text u want in this pageif(session == null){Response.Redirect("NAMEOFTHEPAGE.aspx?session=expired");}On page_load of the NAMEOFTHEPAGE.aspx write the followingif(Request.Params["session"] == expired){Reponse.Clear();Response.Write("<b>Session Expired</b>");} tell me if u n...

Read All Stored Sessions (Sql Session State)
 Hi,I am building a web application and i am storing all the session on mssql server with sqlstate mode. But what i couldn't found is how to read all the stored session from there. For example 10 user is online and they all have session. and now i need to read all this stored variables by this users session. Is there any functionality to make this happen or can someone show me a way to do this ? Regards... One more time to go Hi, You can use "Session.Keys" to get all the keys stored in a session and using this key you can read all the session values  ...

about session expiration and database protection
I developed a web application with login page. I want the login session to expire if the user is idle for 10 minutes or less. I want to know how i can program it in the webpage or web config. Likewise i will like to protect my access database because the link to the database can be type and it wil l be downloaded. I tried using the location tag in the webconfig to deny users access to the database folder but it isn't working do anybody know what i can do to protect my database file. In your web.config, update your sessionState setting<sessionState mode="InProc" stateConnectionStrin...

Web resources about - session expiration to Store Session Expiration Time in Database - asp.net.state-management

Expiration (options) - Wikipedia, the free encyclopedia
In finance, the expiration date of an option contract is the last date on which the holder of the option may exercise it according to its terms. ...

Facebook Sends Notifications To Users With Claimed Offers That Are Near Expiration
The tweaks to Facebook offers continue, with some users seeing notifications alerting them that offers they have claimed will expire soon. continued… ...

Fresh Pantry - Food Expiration Date List on the App Store on iTunes
Get Fresh Pantry - Food Expiration Date List on the App Store. See screenshots and ratings, and read customer reviews.

netflix expiration - Flickr - Photo Sharing!
Explore catastrophegirl's photos on Flickr. catastrophegirl has uploaded 7090 photos to Flickr.

Expiration Date - YouTube
Engineer and Medic make an unsettling new discovery while experimenting with the teleporter. Meanwhile, Scout stops insulting Spy long enough ...

Critics pan Terminator: Genisys in first reviews as 'past its expiration date'
Terminator fans have had high hopes for the latest, fifth instalment in the science-fiction franchise. But now the early reviews of T5 are flowing ...

A good time to go: Baird leaves before election expiration
Baird did what a lot of his colleagues should do. He called his own retirement play.

Expiration date for CNOOC acquisition of Nexen postponed
Expiration date for CNOOC acquisition of Nexen postponed People's Daily Online Expiration date for CNOOC acquisition of Nexen postponed. ( ...

How key-based cache expiration works
... structures, like the one we’re using for Basecamp Next . Thankfully there’s a better way. A much better way. It’s called key-based cache expiration ...

OnePlus X pricing seemingly leaks as OnePlus 2 invite expiration is extended
OnePlus' next handset has been the subject of many a post in recent days and weeks. Dubbed the OnePlus X, one of the only things we've been unclear ...

Resources last updated: 12/11/2015 5:27:48 PM