Trouble displaying meaningful error message on webpage - iis-7

<system.web>
<compilation debug ="true" targetFramework="2.0"/>
<customErrors mode="Off"/>
</system.web>
I'm trying to get some type of meaningful error message instead of some generic HTTP 500 error message. Usually when I set customErrors to off on my other, not related to this webpage that is giving me trouble, it usually produce a meaningful error message on my other apps.
Also this page was created in classic asp.

Classic ASP doesn't use web.config AFAIK (I've always used IIS anyway).
In IIS7, select your site, double click the "ASP" module, expand "Debugging Properties" then set "Send Errors to Browser" to True.

Related

How do I turn off friendly error messages in IIS Express running on Chrome?

I switch from Visual Studio 2013's Development Environment to IIS Express. My browser of choice is Chrome.
I used to get the standard ASP.net error page in D.E. but now I get a friendly error message page in IIS Express. How do I show detailed error messages in Chrome?
In case you're wondering, I know there's an error in my code. I did that on purpose to see how error message's display in IIS Express
How do I display detailed errors in Chrome?
Update: The error was caused by a malformed Web.Config. How do I set up IIS Express to display detailed Web.Config error message?
You need to set in the web.config file
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

What is <customErrors mode="Off" /> for?

What is this for?
ASP.NET error suggested that I have to put this in my web.config file. What do these lines of codes do?
<system.web>
<customErrors mode="Off"/>
</system.web>
You can read about <customErrors> element here on MSDN.
Specifically:
Specifies that custom errors are disabled. The detailed ASP.NET errors
are shown to the remote clients and to the local host.
Custom Error
To customize the default error page, one will have to change the default configuration settings of the application
There are three error modes in which an ASP.NET application can work:
Off Mode
On Mode
RemoteOnly Mode
The Error mode attribute determines whether or not an ASP.NET error message is displayed. By default, the mode value is set to "RemoteOnly".
Off Mode
When the error attribute is set to "Off", ASP.NET uses its default error page for both local and remote users in case of an error.
On Mode
In case of "On" Mode, ASP.NET uses user-defined custom error page instead of its default error page for both local and remote users. If a custom error page is not specified, ASP.NET shows the error page describing how to enable remote viewing of errors.
RemoteOnly
ASP.NET error page is shown only to local users. Remote requests will first check the configuration settings for the custom error page or finally show an IIS error.
More Details and referred from here and this MSDN Site

asp.net Debug server remotely

I keep getting this when I try hit the link of a website I just deployed to the web host's server:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
It Suggests I set the following in my web.config file so I can see details of the error:
The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
So I have added the following to my webconfig file and created a mycustompage.htm relative to the web.config file:
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
My mycustompage.htm is empty, is there anything I should add in there? When I try hit the link now all I get is a blank page after the server tries to redirect to mycustompage.htm.
Depending on what you're trying to accomplish:
1) You want to view the actual error information.
In this case, remove the defaultRedirect attribute and change mode to Off. Custom errors intercept the standard Yellow Screen of Death (YSOD) ASP.NET error page. By setting Custom errors to Off, the YSOD error message will be visible to both local and remote clients (all remote users will see the error details).
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>
</configuration>
2) You want to build a custom error page to handle how your application responds to error conditions.
In this case, you might edit the mycustompage.htm to display a friendly "An error has occurred" message rather than seeing the default Custom Errors are not enabled message.
Link here for reference.

Redirect all asp.net errors to one page preferably through IIS

I am trying to remove all logging and tracing errors on a company website without having to run through and change all of the debugging ="true" statements (several hundred). We will refactor these later however, today, I am looking for a way to push all asp related errors to simple error page or even make everything a 404 error.
Is this possible or am I going to have to change all debug values?
relevant environment info:
.net framework 2.0, iis 7.0
You should be able to use the customErrors section of the web.config to push all errors to a default error page. Something along the lines of:
<configuration>
<system.web>
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly">
</customErrors>
</system.web>
</configuration>

Problem with custom errors in ASP.NET

My setup:
Windows 7 Ultimate
IIS 7
Visual Studio 2008
The scenario:
building a simple website locally
an exception is occurring in my app (this is perfect, since I'm trying to setup a custom error page)
without customErrors setup in the web.config file, I get detailed info about the error
WITH customErrors setup in the web.config file, I get the following page when my error occurs:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.
There's more text than that, but I'm sure you've all seen it before. At this point, the URL is:
http://localhost/bluheron/Error.aspx?aspxerrorpath=/bluheron
So, it looks like it redirected to my error page (Error.aspx), but I'm not seeing my error text ("An error has occurred. Plese try again."). Instead, I'm getting a funky URL with loads of other text, including instructions on how to setup my web.config file, which, by the way, contains this:
<customErrors mode="On" defaultRedirect="Error.aspx" />
It's in the default location, which is inside the system.web section, which is inside configuation section.
By the way, my Error.aspx page is in the root of my app.
Can someone explain what the fancy URL is all about and why my simple error page isn't displaying?
Thanks,
Jay
The error redirect is just what happens normally with customErrors...you can however disable this behavior and preserve the original url (not sending a 302 redirecting your user to the error page's url). This will execute/send the output of your error page:
Add redirectMode="ResponseRewrite" to your customErrors declaration:
<customErrors mode="On" defaultRedirect="Error.aspx" redirectMode="ResponseRewrite" />
If you're still getting the same behavior, there's something wrong with the whole application, and you should turn customErrors off and see what the issue is (this happens with an invalid web.config and many other cases).

Resources