HighTechTalks DotNet Forums  

multiple logins using cache

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss multiple logins using cache in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
seal
 
Posts: n/a

Default multiple logins using cache - 10-26-2005 , 12:44 PM






I have a question regarding keeping a username in the cache in order to
prevent multiple logins. I read 'Preventing Multiple Logins in ASP.NET' by
Peter Bormberg (great article
http://www.eggheadcafe.com/articles/20030418.asp) and everything works fine,
however, I think we are going to have problems from our users having to wait
for their cache to clear out before they can login again. Is there a way to
clear the username out of the cache when they logout? I seem to be missing
something here.

In my logout:
System.Web.Security.FormsAuthentication.SignOut()

Dim i As Integer
For i = Session.Count - 1 To 0 Step -1
Session.Remove(Session.Keys(i))
Next

Session.Remove("user")
Session.Abandon()
Does not work.

When I go back to login, it is still finding the 'user' in the cache
item.?.? Can I not remove this item from the cache? What do I not understand
here?

Reply With Quote
  #2  
Old   
seal
 
Posts: n/a

Default RE: multiple logins using cache - 10-26-2005 , 01:09 PM






Ok, it seems as though I got ahead of myself.

This code added to my logout procedure allows me log out and back on.
Dim _sKey As String
_sKey = Session.Item("user")

If Not _sKey = "" Then
HttpContext.Current.Cache.Remove(_sKey)
End If
Now, how can I handle the user who refuses to use the logout button? If they
just close their browser, I assume there is nothing that can be done except
wait for the cache to expire. Will we be able to release this user somehow in
IIS for those users who will call and complain?


"seal" wrote:

Quote:
I have a question regarding keeping a username in the cache in order to
prevent multiple logins. I read 'Preventing Multiple Logins in ASP.NET' by
Peter Bormberg (great article
http://www.eggheadcafe.com/articles/20030418.asp) and everything works fine,
however, I think we are going to have problems from our users having to wait
for their cache to clear out before they can login again. Is there a way to
clear the username out of the cache when they logout? I seem to be missing
something here.

In my logout:
System.Web.Security.FormsAuthentication.SignOut()

Dim i As Integer
For i = Session.Count - 1 To 0 Step -1
Session.Remove(Session.Keys(i))
Next

Session.Remove("user")
Session.Abandon()
Does not work.

When I go back to login, it is still finding the 'user' in the cache
item.?.? Can I not remove this item from the cache? What do I not understand
here?

Reply With Quote
  #3  
Old   
darrenterrell
 
Posts: n/a

Default Re: multiple logins using cache - 12-02-2005 , 06:39 PM




The only solution that I can think of to solve this problem is to create
a function that will call the server via AJAX to sign out the user. You
can call this function in the unload event for the web page. If you use
master pages or some similar implementation, then this will not be too
difficult to do (since you will need this on every page in the web site
- besides the login page). I have used a similar implementation for
this in the past and it worked well. However, I would still recommend
keeping the server side timeout in place. Things like sudden power
outages will kill the session w/o firing the unload event. Let me know
if you need help w/ any of the code.


seal wrote:
Quote:
*Ok, it seems as though I got ahead of myself.

This code added to my logout procedure allows me log out and back
on.
Dim _sKey As String
_sKey = Session.Item("user")

If Not _sKey = "" Then
HttpContext.Current.Cache.Remove(_sKey)
End If
Now, how can I handle the user who refuses to use the logout button?
If they
just close their browser, I assume there is nothing that can be done
except
wait for the cache to expire. Will we be able to release this user
somehow in
IIS for those users who will call and complain?


"seal" wrote:

I have a question regarding keeping a username in the cache in
order to
prevent multiple logins. I read 'Preventing Multiple Logins in
ASP.NET' by
Peter Bormberg (great article
http://www.eggheadcafe.com/articles/20030418.asp) and
everything works fine,
however, I think we are going to have problems from our users
having to wait
for their cache to clear out before they can login again. Is there
a way to
clear the username out of the cache when they logout? I seem to be
missing
something here.

In my logout:
System.Web.Security.FormsAuthentication.SignOut()

Dim i As Integer
For i = Session.Count - 1 To 0 Step -1
Session.Remove(Session.Keys(i))
Next

Session.Remove("user")
Session.Abandon()
Does not work.

When I go back to login, it is still finding the 'user' in the
cache
item.?.? Can I not remove this item from the cache? What do I not
understand
here? *


--
darrenterrell
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.