Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Errors

Status
Not open for further replies.

Rhys666

Programmer
May 20, 2003
1,106
Ok. I understand the custom errors tag in th web.config file, but custom error pages are simly not working in my ASP.net app. I have posted this on a few forums a while ago but not yet here. If anyone can help...

This is the tag in my web.config file.

<customErrors mode=&quot;On&quot; defaultRedirect=&quot;frmError.aspx&quot; >
</customErrors>

frmError.aspx does exist, and the application has been compiled. However, whenever an unhandled exception occurs I get the standard message...
&quot;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.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This <customErrors> tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode=&quot;Off&quot;/>
</system.web>
</configuration>
&quot;

...instead of the frmError.aspx page being displayed. The <customErrors> tag is with the <system.web> tag. Could it be I need to configure IIS in any way, otherwise does anyone have a clue as to what the hell is going on?


Rhys

Be careful that the light at the end of the tunnel isn't a train coming the other way.
 
Hi Rhys666,

I had exactly this problem last week - my web.config file originated from a template provided by Web Matrix. This file has all the code you need but most of it is commented out, i.e. is between these tags :

<!--
-->

I forgot to move my custom errors code to outside the comment tags and I am wondering if you have done the same!

i love chocolate
 
I don't believe so. I'm using VS.Net 2002 and my system.web area of the web.config file is as below. The bizarre thing is that if I generate an error on my default.aspx page, (which essentially just does a Server.Transfer to my login page) I get re-directed at my Custom error page. It's only after 'logging into' my app that I get my problem, (or at least it was last time I checked this out about 6 weeks ago), and all loging in involves is validating the NT Logon of the user against that held in a database and recording 3 values in the Session object, (which are then verified for existence and validty by all pages within the app).

<system.web>
<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug=&quot;true&quot; to enable ASPX debugging. Otherwise, setting this value to false will improve runtime performance of this application. Set compilation debug=&quot;true&quot; to insert debugging symbols (.pdb information) into the compiled page. Because this creates a larger file that executes more slowly, you should set this value to true only when debugging and to false at all other times. For more information, refer to the documentation about debugging ASP .NET files.
-->
<compilation defaultLanguage=&quot;c#&quot; debug=&quot;true&quot; />

<!-- CUSTOM ERROR MESSAGES
Set customError mode values to control the display of user-friendly error messages to users instead of error details (including a stack trace):
&quot;On&quot; Always display custom (friendly) messages
&quot;Off&quot; Always display detailed ASP.NET error information.
&quot;RemoteOnly&quot; Display custom (friendly) messages only to users not running on the local Web server. This setting is recommended for security purposes, so that you do not display application detail information to remote clients.
-->
<customErrors mode=&quot;On&quot; defaultRedirect=&quot;frmError.aspx&quot;> </customErrors>

<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible modes are &quot;Windows&quot;, &quot;Forms&quot;, &quot;Passport&quot; and &quot;None&quot;
-->
<authentication mode=&quot;Windows&quot;></authentication>

<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application. Set trace enabled=&quot;true&quot; to enable application trace logging. If pageOutput=&quot;true&quot;, the trace information will be displayed at the bottom of each page. Otherwise, you can view the application trace log by browsing the &quot;trace.axd&quot; page from your web application root.
-->
<trace enabled=&quot;false&quot; requestLimit=&quot;10&quot; pageOutput=&quot;false&quot; traceMode=&quot;SortByTime&quot; localOnly=&quot;true&quot; />

<!-- SESSION STATE SETTINGS
By default ASP .NET uses cookies to identify which requests belong to a particular session. If cookies are not available, a session can be tracked by adding a session identifier to the URL. To disable cookies, set sessionState cookieless=&quot;true&quot;.
-->
<sessionState mode=&quot;InProc&quot; stateConnectionString=&quot;tcpip=127.0.0.1:42424&quot; sqlConnectionString=&quot;data source=127.0.0.1;user id=sa;password=&quot; cookieless=&quot;false&quot; timeout=&quot;1200&quot; />

<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization requestEncoding=&quot;utf-8&quot; responseEncoding=&quot;utf-8&quot; />

</system.web>


Rhys

Be careful that the light at the end of the tunnel isn't a train coming the other way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top