7

I have a web application which provides an API in addition to the actual website. I have forms authentication enabled in my application...

Now my problem is in my API endpoints returning a HttpUnauthorizedResult redirects me to the login page....

How can I prevent the redirection from happening and just have a 401 status returned?

tereško
  • 58,060
  • 25
  • 98
  • 150
Whimsical
  • 5,985
  • 1
  • 31
  • 39
  • possible duplicate of [Forms authentication: disable redirect to the login page](http://stackoverflow.com/questions/2839406/forms-authentication-disable-redirect-to-the-login-page) – archil Jan 17 '12 at 13:45
  • solution http://stackoverflow.com/questions/3978334/asp-net-mvc-authorize-attribute-does-a-302-redirect-when-the-user-is-not-authori – Whimsical May 17 '12 at 21:07

1 Answers1

6

This is fixed (as of March 30th):

https://aspnetwebstack.codeplex.com/workitem/15

Brock Allen
  • 7,385
  • 19
  • 24