If you are using the ASP.NET Membership provider:
MembershipUser user = Membership.GetUser(User.Identity.Name);
Guid guid = (Guid)user.ProviderUserKey;
or simply:
Guid guid = (Guid)Membership.GetUser().ProviderUserKey;
More Related Contents:
- Can I set an unlimited length for maxJsonLength in web.config?
- include antiforgerytoken in ajax post ASP.NET MVC
- ASP.Net MVC How to pass data from view to controller [closed]
- Is trying to develop for Medium Trust a lost cause?
- Advantage of creating a generic repository vs. specific repository for each object?
- jqGrid: using multiple methods to filter data
- Asp.Net Forms Authentication when using iPhone UIWebView
- Why does the CheckBoxFor render an additional input tag, and how can I get the value using the FormCollection?
- How to “warm-up” Entity Framework? When does it get “cold”?
- How to render a DateTime in a specific format in ASP.NET MVC 3?
- How to add validation to my POCO(template) classes
- How do I render a partial form element using AJAX
- How to include a partial view inside a webform
- Visual Studio 2012 Web Publish doesn’t copy files
- Connecting to Visual Studio debugging IIS Express server over the lan
- Is it a good practice to avoid using Session State in ASP.NET MVC? If yes, why and how?
- SSL pages under ASP.NET MVC
- How ViewBag in ASP.NET MVC works
- In asp.net mvc is it possible to make a generic controller?
- asp mvc routing with two optional parameters
- Creating a URL in the controller .NET MVC
- Paging & Sorting grids with ASP.Net MVC
- New Asp.Net MVC5 project produces an infinite loop to login page
- JQuery’s $ is in conflict with that of StringTemplate.Net in ASP.Net MVC
- Adding sub-directory to “View/Shared” folder in ASP.Net MVC and calling the view
- Unable to Retrieve Metadata
- Change User Id type to int in ASP.NET Identity in VS2015
- Value cannot be null. Parameter name: items (DrodownList)
- how to know if the request is ajax in asp.net mvc?
- How to decide which is right, WebForms or MVC when doing ASP.NET