MVC ASP.NET - Manually authorize someone and persist the authorization via Forms Authentication

前端 未结 3 1723
無奈伤痛
無奈伤痛 2021-02-04 11:38

I want the benefits of form authentication in ASP.NET. I want it to persist the authorization for me and such, but there\'s one thing different about my situation; I want to au

3条回答
  •  耶瑟儿~
    2021-02-04 12:22

    As Wiktor commented, implement your own MembershipProvider. Just implement the methods you need, leave the rest throwing a NotImplementedException.

    In your case, it looks like all you need to implement is public bool ValidateUser(string username, string password) - the implementation of which just needs to call through to your webservice.

    Then you can use all the standard built-in authentication and authorization stuff.

提交回复
热议问题