Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Forms authentication timeout event?

Posted on 2004-11-14
3
Medium Priority
?
1,451 Views
Last Modified: 2008-02-01
Is there an event fired when ASP.NET automatically logs a user out when using forms based authentication? I want to do two things at the point that the user's timeout (set in the web.config file) expires:

1) I log user activity in a legacy application which is done fine if they LogOut using the logout button, but I need to also add an audit record if the system logs them out.

2) I would like to re-direct to the login page, rather than the default operation which only redirects when they refresh the page.

Thanks.

0
Comment
Question by:sdj_work
3 Comments
 
LVL 6

Expert Comment

by:ryerras
ID: 12578881
I dont what you mean by system logging user out. Ok, if you mean you are logging out the user after the session expires, then "Session_End" fires. This event handler is in Global.asax.cs. In this event handler, you can not do any interactions with the browser, as it is fired with a Http request. You can do any other code behind stuff like, writing to a log application.

There are two ways you can do to redirect the user after certain inactivity. In your html, use  setTimeout setting from javascript to redirect the user. But strictly speaking, client side inactivty does not translate to session inactivity. Session would still gets timed out, even if the user is so active on the browser, but never have to postback in that 20 minutes time (assuming you have the session timeout set to 20 minutes), the session would still timeout. Remember session is a server side object. you can not manipulate it from the client side. But, this is how things are done in real world. Redirect the user after 20 minutes inactivity on the browser

HTH


0
 

Author Comment

by:sdj_work
ID: 12578906
That is not the timeout I mean. I appreciate there is a session timeout, but there is also a timeout for the built in Forms Authentication. For my web app the forms authentication expires after 5 minutes to make sure access to any pages is protected. The session timeout is sometime later, say 15 minutes of inactivity, and this tidies up resources. What I'd like to know is: is there an event fired when ASP.NET logs out the authenticated user?
0
 
LVL 20

Accepted Solution

by:
ihenry earned 375 total points
ID: 12579236
Hello sdj_work

For the question, is there an event fired when ASP.NET logs out the authenticated user?
The answer is short and simple:
Alas, there is no event fires when ASP.NET logs out an authenticated user.

If you need an event to fire, you can use method CacheItemRemovedCallback delegate or define your own class to have a callback method which fires after an interval of time (ASP.NET logs out an authenticated user).
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question