Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 11th, 2003, 02:17 AM
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with Web.Config file

Hi,
I am using the following web.config file.And when there is an error in my code it is not displaying proper error message.I attached both web.config and Error.
Please help me.
web.Config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>

    <!-- DYNAMIC DEBUG COMPILATION
          Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to
          false will improve runtime performance of this application.
          Set compilation debug="true" 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="c#"
         debug="true"
    />

    <!-- 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):

          "On" Always display custom (friendly) messages
          "Off" Always display detailed ASP.NET error information.
          "RemoteOnly" 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="RemoteOnly" defaultRedirect="mycustompage.htm"
    />
   <customErrors mode="on"/>
    <!-- AUTHENTICATION
          This section sets the authentication policies of the application. Possible modes are "Windows", "Forms",
          "Passport" and "None"
    -->
    <authentication mode="Windows" />

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

    <!-- 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="true".
    -->
    <sessionState
            mode="InProc"
            stateConnectionString="tcpip=127.0.0.1:42424"
            sqlConnectionString="data source=127.0.0.1;user id=sa;password="
            cookieless="false"
            timeout="20"
    />

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




 </system.web>

</configuration>



Error:

Server Error in '/a' Application.
--------------------------------------------------------------------------------

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.

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




<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.




<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>




 
Old November 11th, 2003, 10:17 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Just turning on custom errors is not enough. You need to provide a page for each error code you want to handle. For example if you want to show a friendly 404 error, you need something like this in your web.config:

<customErrors mode="On">
    <error statusCode="404" redirect="err404.html" />
</customErrors>

Add an <error.../> node for each error you want to specifically handle.

If you simply wish to just shut off custom errors so you can see the details of the error, set mode to "off".

Also, you have two customErrors nodes in your posted web.config. You only need one. It's possible that two don't do any harm, and it would make sense that the last will override any that come before it. That's most likely why you are not getting the desired results. The last one doesn't specify the default redirect or any error code pages.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old December 2nd, 2004, 10:00 PM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm also having the same problem since a few days and I found out 2 things:

1. It's may sound stupid, but verify that you don't have any trailing spaces after each tags into your Web.Config file.

2. If your CustomErrors tag is well written, debug your project and you will see that even though you get an ASP.NET detailed error page giving you a web.config runtime error instead of your custom error page, the debugger is actually going inside your error page! Break it into your Page_Load (of your error page) and you will see...

Now, if your page is using some Session variables, you will be able to see while debugging that for some reason your session is lost using such redirect. Unfortunately, I haven't found why so I'm giving a start up point for anyone to tell us why...

SDCDominic

 
Old December 6th, 2004, 02:27 PM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello
I new here and I have the same problem, the custom error appears when it wants.
I have 8 months working with vb.net and this problem it make me crazy.
if you know about an articule that explain that it happen i want to know.
thank you.
 jp.net






Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting of web config file epkgupta General .NET 0 July 9th, 2008 09:32 AM
Problems with web.config file !!!!!!!! _fluffy_ BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 October 14th, 2006 10:02 AM
web config file format changed sarah lee ASP.NET 1.0 and 1.1 Basics 0 September 29th, 2006 01:31 PM
web.config file apry BOOK: Beginning ASP.NET 1.0 1 May 27th, 2004 06:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.