How to get another user's profile in ASP.NET MVC?
asp.net-mvc
Solution
this doesnt look obvious but is a get Profile:
ProfileBase profile = ProfileBase.Create(HttpContext.Profile.UserName, true);
returns an existing instance.
Problem
I want to set a cookie with a user's timezone when they login. AccountController.LogOn() seems like the best place to do this. However, I can't yet read a user's profile there since I guess you only have access to profiles when the method completes. So, this code returns an empty string: ``` Dim timeZone = HttpContext.Profile("TZ").ToString ``` Once a user has fully logged on, the above code returns the correct TimeZone. One solution is to read the profile for the username trying to log on in AccountController.LogOn(): ``` ProfileCommon profile = Profile.GetProfile(username); // FAILS ``` However, this doesn't work. So, how do I read a given user's profile if they're not logged in?