Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detecting user already logged in 1

Status
Not open for further replies.

rotsey

Programmer
Nov 23, 2004
135
0
0
AU
Hi,

Would like it if someone can guide me in the right direction.

I have an app with Access database behind it. I have forms authentication with the users stored in the DB.

Question is how do I validate so that a user can only be logged on exclusively to the web app???

rotsey
 
There are lots of ways of attempting to do this but if the user doesn't logout using the "correct" method you may encounter problems.

Some ways to do it are:

1) Store logged in usernames in a table and remove them when they logout
2) Check for the existence of a cookie/session that would indicate whether they are already logged in are store is as an application variable

Please take not of my first statement though as any potential solutions tend to have scenarios when they won't work.

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
application variable should work pretty well. If I store the user ids in a list and add to the list when they login and check the list.

What are the problems with that??
 
The main problem is when/how do you delete it?

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
hmmmm. There are sites that do this well????
 
Well I tend to not worry about it but that is because the applications I develop don't necessarily need it. An example of this is Tek-Tips - I can be logged in from both my home and work pc at the same time and it isn't an issue. Why do you have to make sure that a user is only logged in once?

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
well I have an app that don't want people to use the same account I want them to buy there own account.

I realise there are ways around things but if they can't be logged on at the same time then it would be better.
 
Well there articles on this subject such as:


but I must emphasise that there are potential situations where you may find that you don't get the expected results. It's probably one of the better examples I have seen though.

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Nice article ca8msm. I will use the cache object. I think that it will be sufficient enough solution for my needs.
 
Actually there is one point. the article uses C#.

Cache.Insert(strConCat,strConCat,null,DateTime.MaxValue,SessTimeOut,
CacheItemPriority.NotRemovable,null);

What do I replace the 'null' with in this code??

The first one is System.Web.Caching.CacheDependency
and the second is callback delegate.

hmmmmm
rotsey
 
Microsoft said:
'Null' constant is no longer supported; use System.DBNull instead.

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Well if it works then fine but Microsoft states that System.DBNull should be used instead (and I would go with the framework version anyway).

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
another thing. How can I test this when i have only pc. Because I can't open another browser it just uses the same login when you load the app.

I have to use another pc. Correct???



 
That depends on how you keep the user logged in. Most of the time you should use seperate pc's but you could try different browsers as most of them hold theor own cookies etc.

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top