Pages

MVC Tips and Tricks


Setting up Dependency Resolver with MVC 3 and 4

In order to setup DependencyResolver, you have to create a class which should implementation of IDependencyResolver Interface. First you need a Dependency Injection Containers (IOC) like Unity, Castle Windsor, Ninject, StructureMap, Spring.NET, Autofac, Puzzle.NFactory, PicoContainer.NET, LinFu  or you can create your own IOC based on .Net Reflection. 
 
More details available with an example on my blog post

Custom Authentication


In order to implement custom authentication, application’s forms cookie need to override with custom user object with implementation of IPrincipal and IIdentity interfaces.
When application request for authenticate user then system fire an event of Application object.  
Implement authentication in Global.asax.cs
Add Application_AuthenticateRequest event into the Global.asax with AuthenticationTicket extension method.



More details available with an example on my blog post

Some other important blog posts about MVC 2


 
More blog posts available about MVC on my main page of the blog.

No comments:

Post a Comment