0

I have a error page, so that whenever there is a server error I redirect the page to error.aspx. So when I tested it by removing a parameter from the code, the code fails and it should redirect to error.aspx instead it is still showing the server error in the same page. How should I redirect the page when there is a server error. I have the custom error in my web config

Server Error in '/' Application.

The MySqlParameterCollection only accepts non-null MySqlParameter type objects.
Parameter name: value

<customErrors mode="RemoteOnly" redirectMode="ResponseRewrite" defaultRedirect="error.aspx">
</customErrors>

I have a datalayer where all the db queries are done.

1
  • How did you get on? Does it work now? Commented Jan 26, 2012 at 13:38

1 Answer 1

1
mode="RemoteOnly 

means you'll not use the Custom error page unless it is viewed remotely. Change it to On if you want to see the custom error page from localhost.

This is taken from MSDN:

mode - Specifies whether custom errors are enabled, disabled, or shown only to remote clients.

This attribute can be one of the following values.

On - Specifies that custom errors are enabled. If no defaultRedirect attribute is specified, users see a generic error. The custom errors are shown to the remote clients and to the local host.

Off - Specifies that custom errors are disabled. The detailed ASP.NET errors are shown to the remote clients and to the local host.

RemoteOnly - Specifies that custom errors are shown only to the remote clients, and that ASP.NET errors are shown to the local host. This is the default value.

The default is RemoteOnly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.