0

My project have controllers and API controllers and I have custom HMAC authentication action filter. The problem is that when I am calling action in API controller and user is unauthorized I am getting login page html source code instead of status 401. I want that when user uses my Web Api and when he unauthorized he would get 401 status and when user uses my web application and tries to open page that requires authentication he'd be redirected to login page.

user2412672
  • 1,459
  • 3
  • 20
  • 36

1 Answers1

1

Here is a similar question. Got few solutions. They are different for MVC4 and MVC5.

Take a look at this short article for more information. For older versions take look here.

Community
  • 1
  • 1
aleha_84
  • 8,309
  • 2
  • 38
  • 46