Solved

web.config customErrors Not Working

Posted on 2010-11-29
7
744 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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