views:

14

answers:

1

I'm using FormsAuthentication (with cookies) for users authentication, with the default cookie name (".ASPXAUTH").

What I need is a different login system for the "/Admin/" virtual directory (backed by an ASP.NET MVC controller, "AdminController")... as if the "/Admin/" directory was another web application, but without creating another web project inside my solution.

How can I customize, at runtime, the cookie name used by FormsAuthentication? The FormsAuthentication.FormsCookieName is readonly (and static...), and can be customized only once inside the web.config...

Should I create a custom FormsAuthenticationModule?

A controller filter, like the following, could be great:

[CustomFormsAuthenticationCookie("NewCookieName")]
public class AdminController : Controller
{
A: 

Trick is the underlying authentication framework really can't handle this--you can't have multiple forms authentication bits running. Easiest solution would be to break the admin bits off into a separate website which would end up living elsewhere and not get caught up in the public site's authentication.

Wyatt Barnett
Sadly, I've proposed this very same idea at work, but they rejected it: they don't want to mantain an additional web application :(
Notoriousxl