[CLOSED] [1.0] IIS CustomErrors with redirectMode="ResponseRewrite" causes web.config error message

  1. #1

    [CLOSED] [1.0] IIS CustomErrors with redirectMode="ResponseRewrite" causes web.config error message

    Hi,

    If I have redirectMode="ResponseRewrite" in CustomErrors in web.config, and I cause an error, I get that Ext Js window appear saying "The web.config file for this project is missing the required DirectRequestModule."

    I know there are a number of posts about setting up web.config correctly, and my web.config is set up correctly.

    However, this problem only appears when redirectMode="ResponseRewrite". If I remove that attribute, or set it to redirectMode="ResponseRedirect" then I don't get this problem.

    I have attached a project to reproduce the problem with as minimal code as possible (though you will need to add a reference to Ext.Net.dll because of upload size limits when adding attachments to this forum).

    Here is an example of a View Source when the error page is invoked using redirectMode="ResponseRewrite". Notice the various Ext.Net tags, for instance.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-gb" xml:lang="en-gb">
    <head id="ctl00_Head1"><title>
        Error page
    </title><Ext.Net.InitStylePlaceholder /><Ext.Net.InitScriptPlaceholder /></head>
    <body id="ctl00_Body1">
        <form name="aspnetForm" method="post" action="Error.aspx" id="aspnetForm">
    <div>
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEwMDUyNjYzMjhkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBRZjdGwwMCRSZXNvdXJjZU1hbmFnZXIxS9euP0qJU1i6FbkzX+IFi4OKK78=" />
    </div>
    
    <script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['aspnetForm'];
    if (!theForm) {
        theForm = document.aspnetForm;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    //]]>
    </script>
    
    <div>
    
        <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgKegt6rDQLY0voM9t4MW0dUhxXEfHcBqbb69HMDQ0Q=" />
    </div>
            <Ext.Net.InitScript>
        <script type="text/javascript" src="/extjs/adapter/ext/ext-base-js/ext.axd?v=14475"></script>
        <script type="text/javascript" src="/extjs/ext-all-js/ext.axd?v=14475"></script>
        <script type="text/javascript" src="/extnet/extnet-core-js/ext.axd?v=14475"></script>
    
        <script type="text/javascript">
        //<![CDATA[
            Ext.net.ResourceMgr.init({id:"ctl00$ResourceManager1",BLANK_IMAGE_URL:"/extjs/resources/images/gray/s-gif/ext.axd",aspForm:"aspnetForm",theme:"gray"});Ext.onReady(function(){Ext.QuickTips.init();});
        //]]>
        </script>
    </Ext.Net.InitScript><Ext.Net.InitStyle>
        <link rel="stylesheet" type="text/css" href="/extjs/resources/css/ext-all-embedded-css/ext.axd?v=14475" />
        <link rel="stylesheet" type="text/css" href="/extjs/resources/css/xtheme-gray-embedded-css/ext.axd?v=14475" id="ext-theme" />
    </Ext.Net.InitStyle><Ext.Net.InitScript.Warning><script type="text/javascript">Ext.onReady(function(){Ext.Msg.show({title:'Warning',msg:'The <code>web.config</code> file for this project is missing the required DirectRequestModule.<br /><br /><div style="margin-left:48px;"><b>Example</b><br /><br /><code>&lt;system.web><br />&nbsp;&nbsp;&lt;httpModules><br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" /><br />&nbsp;&nbsp;&lt;/httpModules><br />&lt;/system.web></code><br /><br />More information available at "<a href="https://examples2.ext.net/?/Getting_Started/Introduction/Overview/">Getting Started</a>".</div><br />',buttons: Ext.Msg.OK,icon: Ext.MessageBox.WARNING});});</script></Ext.Net.InitScript.Warning>
            
        <p>Custom error message</p>
    
        </form>
    </body>
    
    </html>
    Notice there's Ext.Net.InitStylePlaceholder tag, for example and yet the CSS is loaded towards the end of the page.

    I hope this is something that can be resolved as using ResponseRewrite for our custom errors is much preferred over redirecting...

    Thanks!
    Attached Files
    Last edited by Daniil; Sep 22, 2010 at 10:32 AM. Reason: [CLOSED]
  2. #2
    Hi,

    I guess redirectMode="ResponseRewrite" prevents any http module executing therefore our module cannot build the page correctly.
    Therefore if redirectMode="ResponseRewrite" is required then do not use Ext.Net controls on the Error reporting page (pure html or use controls via javascript only)

    It is the same problem if use Server.Transfer.
    At this moment we have no any fix/workaround for this problem
  3. #3
    Quote Originally Posted by vladimir View Post
    Therefore if redirectMode="ResponseRewrite" is required then do not use Ext.Net controls on the Error reporting page (pure html or use controls via javascript only)
    Hm... tricky one for me, just based no how our custom error page works, but it may be possible and seems sensible as a general workaround; I can understand why the limitation is there.

    Thanks for prompt response (as usual!). Much appreciated.
  4. #4
    Quote Originally Posted by anup View Post
    Hi,

    I have attached a project to reproduce the problem with as minimal code as possible (though you will need to add a reference to Ext.Net.dll because of upload size limits when adding attachments to this forum).
    Hi anup,

    Please don't worry about attaching Ext.Net dll and others.
    Anyway it would be removed by administrators in according to the forum's rules, for security and save traffic purposes.

Similar Threads

  1. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  2. Replies: 2
    Last Post: Apr 05, 2012, 4:55 AM
  3. Replies: 6
    Last Post: Nov 15, 2011, 2:02 AM
  4. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM
  5. Replies: 16
    Last Post: Oct 15, 2010, 10:04 AM

Tags for this Thread

Posting Permissions