locked
How i cast String to GUID RRS feed

  • Question

  • User324532216 posted

     I want to cast String to GUID. I get the value of GUID using querystring. And now I want to convert this string into the GUID

    I tried like,

    Guid newid= (Guid)(Request.QueryString["id"]); 

    but it gives me built error like

    cannot convert String to System.Guid

    Plz help me how to do this........... 

     

    Tuesday, February 26, 2008 9:39 AM

Answers

  • User960609757 posted

    hi,

    try to like this,

    Guid g = new Guid(Request.QueryString["id"]);


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 26, 2008 1:07 PM

All replies

  • User-647234374 posted

     You can't cast it, you have to convert it. See this link.

    Tuesday, February 26, 2008 12:04 PM
  • User960609757 posted

    hi,

    try to like this,

    Guid g = new Guid(Request.QueryString["id"]);


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 26, 2008 1:07 PM
  • User-1515837791 posted

    Thanks for this - I kept trying .ToString and CStr() with no luck.  This worked great.

    Tuesday, August 30, 2011 10:42 AM