views:

343

answers:

1

We have developed a website that uses MVC, C#, and jQuery. In one of my controller classes we are validating inputs from the user and if it fails we throw an exception that the Ajax error parameter(aka option) handles. (We use Block UI to display the error message. BlockUI is a jQuery plugIn that blocks the screen and displays a message box.) (Yes, the message has text in it with no funny characters or non-sense)

When running the website locally or on a server we receive different effects from the exception being thrown.

Locally: The proper exception is displayed in BlockUI. Server: The message "Runtime Error" is displayed instead of the exception message.

print(  
public ActionResult FailUpdateStatus(string id)
 {
  string message = Request.Form["message"];

  throw new Exception(message);
 });

I have been able to run the website on the server and remote attach to the website. While debugging the exception gets thrown as it should but block UI shows the Runtime error.

Any ideas?

+1  A: 

By default, ASP.NET web applications will hide errors from remote machines accessing the site, and will only return the generic 'Runtime Error'. ASP.NET will only show application specific error messages when the site is accessed locally (i.e. if the ASP.NET application server is running on your local development machine, or if you open up a web browser on the server hosting the ASP.NET web application).

To view messages generated on a remote server from a local client, add the following code to your web.config file.

<configuration><system.web><customErrors mode="Off"/></system.web></configuration>
Maitus
Awesome. Worked and it was only 1 simple little line. Thanks
Brad8118