FormsAuthentication with MVC Integration

In the example of Login for MVC with SS auth, after successful authentication the user is “logged in” to ASP.NET auth.

Like this: FormsAuthentication.SetAuthCookie(userName, true);

Why is this necessary?

It’s used to enable Custom Forms Authentication in MVC. Here’s another answer explaining it.
But it’s not used by ServiceStack itself.

Hi @mythz

I’ve disabled ASP.NET auth in web.config <authentication mode="None"/>. So I’m not calling FormsAuthentication.SetAuthCookie(userName, true); any longer. I’m only using SS attributes for requiring authd user / roles. Everything is working fine with this setup. Do you see any problems with this?

There’s no problem if you’re only using ServiceStack Auth and Attributes as it’s completely decoupled from ASP.NET Auth.

Thanks for confirming :smile: