Custom Authentication and ASP.NET MVC

前端 未结 5 1355
独厮守ぢ
独厮守ぢ 2020-12-13 00:50

I have an internal web app being built in ASP.NET 4. We are stuck with using an authentication API built by another team. If a user to the site is authenticated

5条回答
  •  無奈伤痛
    2020-12-13 01:19

    You can try with something like this:

    FormsAuthentication.SetAuthCookie(username, rememberMe);
    

    to set the cookie for authenticated user, then just use the [Authorize] attribute on the Controller or Action that need authentication.

    Try googling on the subject for further info, you will find a lot of stuff on authentication and authorization in MVC.

提交回复
热议问题