1

I am using visual studio 10 .Net framework 4.0. I want to send a HTTP response with status code 401. I tried the solution from this.

My code is:

context.Response.ClearContent();
context.Response.StatusCode = (int) HttpStatusCode.Unauthorized;
context.Response.End();

But I still get status code 200. How do I generate 401 status code?

Bibek Shah
  • 419
  • 4
  • 19
  • I have found the cause of the problem. The problem was that it was being redirected to login page for which the 200 status code was generated. – Bibek Shah Aug 05 '18 at 10:06

0 Answers0