Solved

web.config customErrors Not Working

Posted on 2010-11-29
7
742 Views
Last Modified: 2012-05-10
My redirect code in customErrors in web.config has suddeny stopped working.  It probably has to do with updating to asp.net 3.5 from 2.0 last week.  Though I'm not sure how. I didn't notice until today that I am now getting the standard 404 error instead of being redirecting to the .aspx page I specified.

Here is my code in web.config:

    <customErrors mode="On" defaultRedirect="ExceptionPage.aspx">
            <error statusCode="404" redirect="redirect.aspx"/>
    </customErrors>

This all works on my development machine.  It is only broken on the hosted site.

All help is greatly welcomed.

Thanks,
Hunter
0
Comment
Question by:hzuker44
7 Comments
 
LVL 13

Expert Comment

by:themrrobert
ID: 34235856
Check and make sure that 3.5 didn't add any include files to web.config or any code tacked on that may overwrite your settings, this is the most common cause of backward compatibility failure
0
 

Author Comment

by:hzuker44
ID: 34235971
I did look at the differences between the old and new web.config files.  But I really couldn't tell what might affect customErrors this way.

Here are the changes I see:

In the new web.config the following 4 lines were added:

    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

There are a lot of lines were the version was changed to 3.5.  I assume they're OK.
 
And the following code is all new:

<compilers>
    <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    <providerOption name="CompilerVersion" value="v3.5"/>
    <providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
    <providerOption name="CompilerVersion" value="v3.5"/>
    <providerOption name="OptionInfer" value="true"/>
    <providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom>
    <runtime>
         <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly>
            <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly></assemblyBinding></runtime></configuration>


I'm not smart enough to know if these changes would affect customErrors.    
0
 
LVL 14

Accepted Solution

by:
robasta earned 500 total points
ID: 34237342
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:hzuker44
ID: 34241850
I don't think this is the issue.  I'm getting the error on remote machines.  This article seems to be for Remote Only situations.  

Plus, I didn't change IIS versions, I  changed ASP.NET versions (from 2.0 to 3.5).  It was working before on which ever version of IIS I'm on and now it isn't.  (It's not working on a hosted version of my site so I'm not 100% sur which version of IIS I'm using.)
0
 

Author Comment

by:hzuker44
ID: 34425522
Robasta's answer did not really address my problem.

I think I have found the issue with this.  It looks like URLs with specific extensions (like aspx) get redirected properly.  But I need to redirect everything (normally 404s) via customErrors regardless of the extension.  So I need all types to be mapped to aspnet_isapi.dll.  
 
I found a link that seems to describe this problem:  http://forums.asp.net/t/1521191.aspx  (The relevant part is midway down the discussion posted by Thomas Sun – MSFT ).  He in turn points to a link that has specific directions on what needs to be done in IIS.

I'm not 100% sure that this the issue as I'm having problems with my host company to implement this.  But it seems to explain everything that I see.
0
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 34429113
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now