Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom error pages
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01167657
Message ID:
01176421
Views:
8
You can't actually fire an error by just setting the Response.Status of the request. These error mappers work through ASP.NET's error handlers which occur prior to code ever reaching your page logic (well at least in the case of 400 style errors).

Michel's point is right on - you need to throw an exception to make this happen explicitly, but then you could probably just redirect directly to this page.

+++ Rick ---

>Hello Team, I am obviously doing something wrong ... Why do I get the default IIS error pages given the following code:
>
>
Context.Response.Clear();
>Context.Response.StatusCode = 403;
>Context.Response.End();
>
>and a web.config that has:
>
><customErrors mode="On" defaultRedirect="defaultError.htm">
>   <error statusCode="404" redirect="~/NotFound.aspx" />
>   <error statusCode="403" redirect="~/NoAccess.aspx" />
></customErrors>
>
>My thanks in advance,
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform