I am using Response.Redirect to redirect the user to a new page but I want the page to be shown only if there is a particular parameter in the query string. Otherwise, I want an HTTP 401 authentication error page to be shown. Can that be done? If yes, how? If not, why not?
Share
From your page, you could redirect to an
IHttpHandlerthat would output the content for your authentication error page and would set the HTTP status code to 401.The MSDN topic for IHttpHandler as some links that may help you understand what is an HTTP handler and how you can implement one. The most important ones are:
HTTP Handlers and HTTP Modules Overview
Walkthrough: Creating a Synchronous HTTP Handler
How to: Register HTTP Handlers