Generating Unique Strings in NET

Approach 1:

String s1 = Guid.NewGuid().ToString();
String s2 = Guid.NewGuid().Tostring("N");
String s3 = Guid.NewGuid().ToString("P");
String s3 = Guid.NewGuid().ToString("D");


Approach 2:

String s1 = System.IO.Path.GetRandomeFileName();
String s2 = System.IO.Path.ChangeExtension(System.IO.Path.GetRandomFileName(),null);

Comparison or the 2 Approaches:
1. Approach1 generates at least 32 characters (0-9 and a-f) letters only.
Hint: larger size on the database, absolutely unique.
2. Approach2 Generates at least 8 characters (0-9 and a-z) letters.
Hint: Good for Captcha, less size on the database,  might have duplicates

Advertisements