Published on March 7, 2014
How to implement a custom IPrincipal in ASP.NET MVC Nat 20140224
Why ? We want more user information in Principal object Ex. User.MemberID User.LoginID
IPrincipal and IIdentity System.Security.Principal.IPrincipal Page.User Controller.User System.Security.Principal.IIdentity User.Identity
How Define a class which implements IPrinicpal interface Save custom settings to Cookie Restore custom settings on every request Replace User object on PostAuthenticateRequest event
Implementation public class CustomPrincipalSerializeModel public class CustomPrincipal : IPrincipal Signin – save custom settings Login action Request – restore custom settings Global.asax - Application_PostAuthenticateRequest
Implementation Replace (User as CustomPrincipal).LoginID with User.LoginID public class CustomController : Controller
Implementation Replace @(User as CustomPrincipal).MemberID With @(User.MemberID) public abstract class CustomWebViewPage : WebViewPage public abstract class CustomWebViewPage<TModel> : WebViewPage<TModel> Views/Web.config <pages pageBaseType="CustomWebViewPage">
Reference http://www.codeproject.com/Tips/574576/How-to-implement-a-customIPrincipal-in-ASP-NET-MV http://stackoverflow.com/questions/1064271/asp-net-mvc-set-customiidentity-or-iprincipal
... in my ASP.NET MVC application, I want to set a custom ... have to implement both IIdentity and IPrincipal. ... Set custom IIdentity or IPrincipal.
I have a basic MVC 2 beta app where I am trying to implement a custom Identity and Principal classes. I have created my classes that implement the ...
Custom Authentication with MVC 3.0. ... Since this class implements IPrincipal,it can be used to bind ... Inherit from the IPrincipal interface in a custom ...
As we all know Authentication and Authorization plays a vital role in the windows, web and mobile application. Asp.net mvc default provide as IPrincipal ...
I have created a Custom Authentication provider by implementing IHttpModule. ... Implements IPrincipal ... implement a custom IPrincipal in ASP.NET MVC ...
... of custom membership and role provider. ... Custom Identity and IPrincipal in MVC I have a basic MVC 2 beta app where I am trying to implement a custom ...
IPrincipal (User) ModelBinder in ASP.NET MVC for easier testing ... IPrincipal user) ... use a custom attribute like ...
Custom IPrincipal .NET Framework > ... The idea is to implement my own IPrincipal class and have the ability to include some custom properties ...
How To: Create a Custom Account to Run ASP.NET 1.1. ... How To: Implement IPrincipal in ASP.NET 1.1. J.D. Meier, Alex Mackman, Michael Dunner, ...