Solved

web.config customErrors Not Working

Posted on 2010-11-29
7
743 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

932 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

11 Experts available now in Live!

Get 1:1 Help Now