1

I'm trying to return the 403 state code page .. i tried this code from controller :

Response.StatusCode = 403;

But it's not works with me .. when i run the localhost the page keep show the real content and not showing the forbidden error page!

can someone explain to me what to do to show 403 forbidden page from controller ?

Dummies EBooks
  • 175
  • 3
  • 12
  • Well what are you returning in your response? The code only tells the caller what happened so they can handle it, but if you return the same content/page when an error occurs then the caller will still receive that. – Karl Sep 22 '18 at 15:52

1 Answers1

2
return new HttpStatusCodeResult(HttpStatusCode.Forbidden);

Asp.Net web service: I would like to return error 403 forbidden

Liam Kernighan
  • 2,335
  • 1
  • 21
  • 24