Friday, November 01, 2013

Showing Detailed Errors with Classic ASP

Many hosting companies had detailed errors turned off, as information in the error messages can often provide hacker with clues that allow them to hack web sites. But as developers, we all know that just because everything worked great in the development environment, doesn't mean it all works when we upload to production. And those error messages are essential when debugging Classic ASP.

So you FTP your site up, go and get the 500 Internal error, with no clue as to what it is. Here's how to get those detailed error messages back so you can debug.

Create a web.config file

In that file enter:

<?xml version="1.0" encoding="UTF-8"?>
  <configuration>
    <system.webServer>
    <httpErrors errorMode="Detailed" />
  </system.webServer>
</configuration>

Save the file and upload it to the web server. Viola! Now you can get a detailed error so you can see just where the where the error is happening and what it is.

I suggest that once you solve the issue, that you turn detailed errors back off again. Every little bit of security helps when it comes to keeping your site secure.