I have this code sample:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%
if (Request.IsAuthenticated) {
%>
Welcome <b><%= Html.Encode(Page.User.Identity.Name) %></b>!
The catch is I am putting the user's id and not name into the 'username' field:
User user = _userRepository.Get(...);
FormsAuthentication.RedirectFromLoginPage(user.Id.ToString(), false);
The first code sample is included in the Master View, and so appears in every view. What I don't understand is how to pass that view the User model entity, since I am not calling it directly.
Edit: Is there a single point in processing an HTTP request where I can intervene to inject the User model object into the ViewData? I would not want to touch every controller+action to achieve this.