lollercoaster
lollercoaster

Reputation: 95

FormsAuthentication.SetAuthCookie

I am developing an asp.net mvc application and have created my custom user database and registration procedure (need email verification). Can I use FormsAuthentication.SetAuthCookie with my own login procedure, without dealing with asp.net's membership provider? Will doing so work with the [Authorize] attribute?

Upvotes: 2

Views: 2519

Answers (1)

alexn
alexn

Reputation: 58982

Yes, you can use FormsAuthentication.SetAuthCookie within your own login procedure, in fact, that's what the default asp.net mvc template uses.

[Authorize] will work since FormsAuthentication.SetAuthCookie populates HttpContext.User.Identity.IsAuthenticated to true.

Upvotes: 3

Related Questions