how do generate unique alpha numeric random number in asp.net

Posted by Kannan1986 under ASP.NET on 2/4/2010 | Views : 34189 | Status : [Member] | Replies : 2
how do generate unique alpha numeric random number in asp.net




Responses

Posted by: Poster on: 2/4/2010 [Member] Starter

Up
0
Down
Here is the super easy way to do that. Following code snippet will give you 8 digit alphanumeric random string.

      Guid g = Guid.NewGuid();

string random = g.ToString();
Response.Write(random.Substring(0, 8));


In the 3rd line you can replace 8 with whatever number (10, 12 etc) and then you may find - that you can replace with empty string.

Please "Mark as answer", if this helped.

Thanks

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/24/2010 [Member] Bronze

Up
0
Down
Check
http://bytes.com/topic/c-sharp/answers/587443-generate-unique-random-string

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response