advertisement

Implement custom iprincipal in mvc

93 %
8 %
advertisement
Information about Implement custom iprincipal in mvc
Technology

Published on March 7, 2014

Author: ltcrd

Source: slideshare.net

advertisement

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

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

ASP.NET MVC - Set custom IIdentity or IPrincipal - Stack ...

... in my ASP.NET MVC application, I want to set a custom ... have to implement both IIdentity and IPrincipal. ... Set custom IIdentity or IPrincipal.
Read more

Implementing a Custom Identity and IPrincipal in MVC

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 ...
Read more

Custom Authentication with MVC 3.0 - bradygaster.com

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 ...
Read more

Implementation of custom IPrincipal and IIdentity asp.net mvc

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 ...
Read more

Custom Authentication provider by implementing IHttpModule ...

I have created a Custom Authentication provider by implementing IHttpModule. ... Implements IPrincipal ... implement a custom IPrincipal in ASP.NET MVC ...
Read more

mvc implementing iprincipal and iidentity with use of ...

... 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 ...
Read more

IPrincipal (User) ModelBinder in ASP.NET MVC for easier ...

IPrincipal (User) ModelBinder in ASP.NET MVC for easier testing ... IPrincipal user) ... use a custom attribute like ...
Read more

Custom IPrincipal - social.msdn.microsoft.com

Custom IPrincipal .NET Framework > ... The idea is to implement my own IPrincipal class and have the ability to include some custom properties ...
Read more

Building Secure ASP.NET Applications: Authentication ...

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, ...
Read more