?
Solved

web.config customErrors Not Working

Posted on 2010-11-29
7
Medium Priority
?
750 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 total points
ID: 34237342
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

777 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