misho
misho

Reputation: 1195

Which kind of user's information I can use for create unique user's key?

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?

Upvotes: 1

Views: 108

Answers (3)

VladV
VladV

Reputation: 10349

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).

Upvotes: 0

Mamta D
Mamta D

Reputation: 6450

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.

Upvotes: 0

Andrew Hare
Andrew Hare

Reputation: 351516

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.

Upvotes: 8

Related Questions