tags:

views:

56

answers:

3

Hi all.

I've next problem: I need create unique user key based on user's information what I can receive from user's request to my web-page (ASP.NET).

I'll use this key for auto-login functionality (I know about cookie ^^)

What kind of information I can use? Can anybody help me?

+8  A: 

If you are creating the key yourself then use one of .NET's integral types (int or long tend to be the most commonly used) or a Guid.

If you are using user-supplied data then use something like an email address that is unique to the user.

Andrew Hare
If you use something like an email address, make sure you do not disclose this key to others (like /[email protected] )
Thilo
@Andrew Hare: No, you don't understand my problem. I need unique key, which I can dynamically generate when user open my page. Like "remember me"
misho
@misho, Andrew says you can dynamically generate a GUID at run time. If you store this in a cookie then you can use this in a "remember me" function
Matt Ellen
A: 

A good idea would be to concatenate some text part from the user's information (eg: name) with an autoincremented number. This way the key would be alphanumeric and at the same time unique.

Mamta Dalal
A: 

The question is not clear, imho. What is the environment of your site (intranet/Internet, open/closed registration etc.)?

Do you need to just "recognize" a user who comes back to your site after some time?
In this case, cookie with a GUID is probably just fine.

Or do you want to "recognize" users (from a previously known list) without them typing anything at all?
Then, a proper solution is to use either integrated authentication (provided that the users are in the domain, that is, your site must be intranet-only) or HTTPS with client authentication using SSL certificates (works for Internet as well).

VladV