I have a WPF client with an ASP.NET Web API server. I would like to generate a unique key for any particular Windows User that uses the client, so that the Web API can block multiple login attempts from that user. I first considered just using:
Environment.UserDomainName + "\" + Environment.UserName
UserDomainName + "\" + Environment.UserName
You could use the GUID system, and something like:
key = Guid.NewGuid() + "\\" + Environment.UserDomainName + "\\" + Environment.UserName;
One problem is that there is a really small chance that the same GUID will be regenerated, to prevent this you could store all your 'used' GUID in a list/dictionary and regenerate one on any duplication.