开发者

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

开发者 https://www.devze.com 2023-01-12 03:51 出处:网络
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'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).

开发者_如何学JAVAI'll use this key for auto-login functionality (I know about cookie ^^)

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


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消