1

I'm using jqgrid in a project. And need to know how to return/set error responses on the webserver to allow custom messages.

On my local instance i get the following result. Local

But on the deployed site on our webserver the messages get suppressed and replaced with the default message. Server

It's worth a mention that i return the error/failed result by setting the response status code to 500, and setting the description to my custom message. (is there perhaps a better way to do this)

Also ive added/modified the following config values.

<customErrors mode="On" />

<system.webServer>
       <httpErrors errorMode="Custom" >
         <remove statusCode="500" />
       </httpErrors>
</system.webServer>

Does anyone know what im doing wrong? Or how to get it working :P

0

2 Answers 2

1

Please try this, its better way for Custom Error Handling

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

3 Comments

I implemented this fix, def a better way of error handling, but i still have the same issue. The status code gets set to 500 and the custom message gets suppressed and replaced by the default error messages
Seems that your action filter event is not executing, either exception is handled before it (e.g. in Application_error event in global.asax) or another exception is occurring after action filter, please verify.
It's executing... but i just noticed this line in the global. public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); } Will remove it now and see if it somehow overrides the custom error attribute
0

I found a solution. Before i updated my web.config to

<system.webServer>
       <httpErrors errorMode="Custom" >
         <remove statusCode="500" />
       </httpErrors>
</system.webServer>

It was set to (which explains why I experienced the issue in the first place, as I was accessing the site from a remote source)

<system.webServer>
       <httpErrors errorMode="DetailedLocalOnly" />
</system.webServer>

Changing it to the following

<system.webServer>
           <httpErrors errorMode="Detailed" />
</system.webServer>

and implementing Muhammad Mudassir suggestion, seemed to do the trick.

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.