Hey, I'm a first time write long time reader of this site.
I'm building an .NET MVC site, using ProfilBase to store a custom user object. The profile base is stored on an database on an other server than the webserver. I have an helper class, UserInfoHelper that contains static method to retrive username, email, telephone etc.
Right now a method to for examlpe get retive the email address looks like this:
public static String GetEmail()
{
ProfileBase profileBase = HttpContext.Current.Profile as ProfileBase;
UserObject user = (UserObject)profileBase.GetPropertyValue("UserObject");
return user.PrimaryEmail;
}
And from a view i call them like this:
<%= UserInfoHelper.GetEmail() %>
So for each time when i call a method in the helper class the user is fetch from the db. I would like it to just fetch it once for each user when loged in or att least once per response. What is the best approach to do this.
Also is there an easy way to get the default ProfileBase using web services instead of calling the stored procedures direcly?
Many thanks in advance.