How to override the (root sites) error settings in a subsite

Discussion in 'ASP.NET 2.0' started by Erikkl2000, May 21, 2007.

  1. Hi,

    I need to override the root websites error page settings in the web.config and use the settings in my subwebiste.

    Here are my settings in the subwebsite that i need to use to override the root website


    <customErrors mode='RemoteOnly' defaultRedirect='~/Errors/Errors.aspx'>
    <error statusCode='500' redirect='~/Errors/Errors.aspx'/>
    <error statusCode='404' redirect='~/Errors/Errors.aspx'/>
    </customErrors>



    thanks

    erik

    http://www.ErikLittle.com
    http://www.StarterSolutions.com
    http://www.BidWar.com
    http://www.constructionsupercenter.com
    http://www.BuildersStop.com
    http://www.ContractorsStop.com
    http://www.ProjectMaterials.com
    http://www.RehabMaterials.com
    http://www.RehabCafe.com
    http://www.SuperCenterPages.com
    http://www.SuperPagesDirectory.com
    http://www.TupeloBuilders.com
    http://www.TupeloContractors.com
     
  2. Create a web.config for the subapplication and place this code in it.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    When you say it did nothing, what do you mean? Can you elaborate on the problem further?
    Is there a URL that can show us the problem?


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  4. When I inputted and fictitious aspx page the correct error page pulled up. When I inputted a fictitious subdirectory, asp page, html page, it reverted to another error page. This is the by design of IIS. All .aspx page will be handled by the aspnet and everything else will be managed my IIS. So the customerror configuration you incorporated on the web.config file will only work on asp.net web applications. Not really sure an easy way around this. You might want to have a generic error message for non aspnet webapplication with a backpage link so that it will take them back to the last page they were on.
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    erik.


    i am lost as to what your application is supposed to do. Can you further explain?


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. Your custom error is working. If you input a non-existing .aspx page, it will redirect to your customerror page that is dictated by your web.config file. All other types of webpages 'asp, html, htm, php' and even fictious subdirectories will be controlled by IIS. Since your custom error for IIS is set to point to oops.htm, it will redirect it back to oops.htm. I have tested IIS and even with wild card mapping enabled, IIS will be used to determine which customer error to display and not your web.config file.
     
  7. thanks>>>>>>>>>>>>>>>>>.




    Post Edited By Moderator (Eric [DASP]) : 5/24/2007 5:24:09 PM GMT
     

Share This Page