Add ASP.NET Membership tables to my own existing database, or should I instead configure a separate ASP.NET membership database?

I personally just added the asp.net membership stuff to my own database. I then wrote a basic wrapper class around System.Web.Security.Membership class so that the code acts like its using its own membership stuff. Its pretty slick and not that hard to do. If you need assistance setting it up, here is what I did. … Read more

ASP.NET MVC redirect to an access denied page using a custom role provider

[AccessDeniedAuthorize(Roles=”SuperAdmin”)] public class SuperAdminController : Controller AccessDeniedAuthorizeAttribute.cs: public class AccessDeniedAuthorizeAttribute : AuthorizeAttribute { public override void OnAuthorization(AuthorizationContext filterContext) { base.OnAuthorization(filterContext); if(filterContext.Result is HttpUnauthorizedResult) { filterContext.Result = new RedirectResult(“~/AcessDenied.aspx”); } } }

Is it possible to change the username with the Membership API

It’s true that the default SQL Membership Provider does not allow username changes. However, there’s no intrinsic reason to prevent users from changing their usernames if you have a valid argument, on your site, to allow it. None of the tables in the SQL database have the username as a key, everything is based on … Read more

SimpleMembership with custom database schema in ASP.NET MVC 4

I asked the same question to the product team. The design goal of SIMPLE membership was to work out-of-the box as simple as possible. So really there’s no customization possible as far as the tables are concerned. The recommended workaround is, to still use ASP.NET Membership (SqlMembershipProvider).

Which authentication and authorization schemes are you using – and why?

Actually, the answer is probably a combination of 1 and 3. You can take advantage of a lot of the tools and features that the framework provides for you by writing a membership, role or profile provider if the default options don’t quite go as far as you’d like. We’ve done just that on a … Read more

To call this method, the “Membership.Provider” property must be an instance of “ExtendedMembershipProvider”

Try setting the following up in your web.config within the <system.web> node: <roleManager enabled=”true” defaultProvider=”SimpleRoleProvider”> <providers> <clear /> <add name=”SimpleRoleProvider” type=”WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData” /> </providers> </roleManager> <membership defaultProvider=”SimpleMembershipProvider”> <providers> <clear /> <add name=”SimpleMembershipProvider” type=”WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData” /> </providers> </membership> <sessionState mode=”InProc” customProvider=”DefaultSessionProvider”> <providers> <add name=”DefaultSessionProvider” type=”System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ connectionStringName=”DefaultConnection” /> </providers> </sessionState> Sounds like SimpleMembership … Read more