Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Guid to string problem

Status
Not open for further replies.

MalCarne

Technical User
Apr 1, 2005
70
US
This should be ridiculously easy, but it seems that I'm missing something. I need to convert a Guid to a string:
Code:
Guid userkey = (Guid)Membership.GetUser(User.Identity.Name).ProviderUserKey;

is all fine and well.
It makes sense that I could then do something like:

Code:
string userkey = (Guid)Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString();

But that and any other attempts that I've made result in:
CS0030: Cannot convert type 'string' to 'System.Guid'

Has anyone else run across this or know of a solution? Thanks.
 
How about this?

Code:
string userkey = ((Guid)Membership.GetUser(User.Identity.Name).ProviderUserKey).ToString();

Sunil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top