This is my first post on ASP.NET MVC so I'm gonna keep it short and sweet (I'm sure they'll be plenty more to come :-D).
On a MVC View Page, you can access the user that has been previously authenticated with ease:
<%= User.Identity.Name %>
Unfortunately, you can't do the same in an MVC View User Control because they don't have a property called User. Instead, you have to use the ViewContext property which is available on any MVC View:
<%= ViewContext.HttpContext.User.Identity.Name %>
No comments:
Post a Comment