[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3606
  • Last Modified:

guid showing as 00000000-0000-0000-0000-000000000000 ?

hi,

im using guids.

when i try to view in debug or use response.write i only ever get:
00000000-0000-0000-0000-000000000000

i know the guid is working but how can i view its value?
0
scm0sml
Asked:
scm0sml
1 Solution
 
DrunkenELFCommented:
Use UUIDGEN or GUIDGEN to generate your own guid.

00000000-0000-0000-0000-000000000000
Null guid is just a placeholder.
0
 
prairiedogCommented:

Dim guidResult as String = System.Guid.NewGuid().ToString()

Open in new window

0
 
HeoQueCommented:
the following vb.net code will generate a random guid:

Dim myGuid As Guid = Guid.NewGuid()

Open in new window

0
 
harwantgrewalCommented:
Hi scm0sml
Result of below code is
MY GUID = 1088729d-124d-4d0e-b5f3-d9ac36d787bb

Result of next code is
MY GUID = e7bb3880-9594-48a3-bf13-818c7c60d079

Harry
    protected void Page_Load(object sender, EventArgs e)
    {
        Guid _myGUID = new Guid("1088729d-124d-4d0e-b5f3-d9ac36d787bb");
        Response.Write("MY GUID = " + _myGUID.ToString());
        
        Guid _myGUID = Guid.NewGuid();
        Response.Write("MY GUID = " + _myGUID.ToString());
 
    }

Open in new window

0
 
scm0smlAuthor Commented:
i didnt want to generate a new guid i juyst wanted to be able to view it as it wasnt showing up in code as anything other than the place holder.

harwantgrewals answer did the trick:
Guid _myGUID = new Guid("1088729d-124d-4d0e-b5f3-d9ac36d787bb"); replacing the guid with a string variable
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now