How to cast a STRING to a GUID
- by GIbboK
Hi, I need cast a String to a Guid.
I am using this code but
string myUserIdContent = ((Label)row.FindControl("uxUserIdDisplayer")).Text;
Guid myGuidUserId = new Guid(myUserIdContent); // PROBLEM HERE
MembershipUser mySelectedUser = Membership.GetUser(myGuidUserId);
I receive this error
Exception Details: System.FormatException: Unrecognized Guid format.
ANy other ways to do it?
thanks