Click here to Skip to main content
15,867,986 members
Articles / Web Development / ASP.NET

ASP.NET MVC3 Forms Authentication

Rate me:
Please Sign up or sign in to vote.
4.75/5 (8 votes)
28 Aug 2011CPOL5 min read 69K   3.1K   50  
In this article, I want to change the default ASP.NET MVC Forms Authentication code to reflect my thoughts on how the code should be organized.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Demo.Web.ServiceInterfaces;
using Demo.Base;

namespace Demo.Web
{
    public static class WebRegistry
    {
        public static IDependencyLocator DependencyLocator;

        public static IFormsAuthenticationService FormsService
        {
            get
            {
                return DependencyLocator.LocateDependency<IFormsAuthenticationService>();
            }
        }
        
        public static IMembershipService MembershipService
        {
            get
            {
                return DependencyLocator.LocateDependency<IMembershipService>();
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Senior Software Developer from New Jersey, USA

Have 15+ years experience on enterprise application development with various technologies.

Comments and Discussions