user1031034
user1031034

Reputation: 856

Questlon about FormsAuthentication

In LogIn method I have:

FormsAuthentication.SetAuthCookie(model.User, false);

and to get name of this user we use

 User.Identity.Name

Is possible to get for example type account from databese?

I mean, during when user is Loging, type account is send (to cookie?). And use this type in view using something like User.Identity.Name without using controller. Is possible to do something like that?

Upvotes: 0

Views: 98

Answers (1)

Garrett Vlieger
Garrett Vlieger

Reputation: 9494

If I'm understanding your question right, I think your best bet would be using an ASP.NET Profile Provider. With the Profile Provider, you can do something like:

HttpContext.Current.Profile.AccountType

You'll need to do a few things to make it work in MVC. See here for more info:

Implementing Profile Provider in ASP.NET MVC

Hopefully this helps, and I'm interpreting your question correctly.

Upvotes: 1

Related Questions