ASP.NET MVC redirect to an access denied page using a custom role provider

后端 未结 9 1975
忘了有多久
忘了有多久 2020-12-12 11:20

I\'m creating a custom role provider and I set a Authorize attribute specifying a role in my controller and it\'s working just fine, like this:

[Authorize(Ro         


        
9条回答
  •  伪装坚强ぢ
    2020-12-12 11:42

    Redirect is not always the best solution

    Use standard http code 403:

    return new HttpStatusCodeResult(HttpStatusCode.Forbidden);
    

提交回复
热议问题