Basic authentication in ASP.NET MVC 5

前端 未结 7 1956
执念已碎
执念已碎 2020-12-07 13:58

What steps must be done to implement basic authentication in ASP.NET MVC 5?

I have read that OWIN does not support cookieless authentication, so is basic authenticat

7条回答
  •  孤城傲影
    2020-12-07 14:26

    you can try this package on Nuget (AuthPackage) its enables you to add authentication to your asp.net mvc easily.

    1. install package using Package Manager Console:

      Install-Package AuthPackage

    2. add Connection String to your Web.config in (appSettings):

       
      
    3. you're ready to register users, login, logout

    example:

     public async Task SignIn()
        {
            var context = System.Web.HttpContext.Current;
            AuthUser authUser = new AuthUser(context);
            await authUser.SignIn("waleedchayeb2@gmail.com", "123456");
            return RedirectToAction("Index", "Home");
        }
    

    You can read the Documentation here

提交回复
热议问题