c# - How to throw HTTP errors? -


I am using a response. Redirect to redirect the user to a new page, but I want the page to be shown only when a specific parameter in the query string otherwise, I should be shown an HTTP 401 authentication error page. Can it be done? if so, how? If not, then why not?

From your page, you have IHttpHandler for your authentication error page Will output the content and set the HTTP status code to 401.

  Public Zero Process Request (HttpContext Reference) {context.Response.ContentType = "text / plain"; Context.Response.Write ("Authentication Error"); Context.Response.StatusCode = 401; }  

Some of the links that can help you understand what an HTTP helper is and how you can implement one is the most important people:

< / P>


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -