0

I have this web config:

<?xml version="1.0"?>

<configuration>
  <configSections>
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <!--maxRequestLength = maximum upload size =- 4096KB = 4MB-->
    <httpRuntime maxRequestLength="409600000"/>
  </system.web>

  <system.webServer>
    <rewrite>
      <rules>
        <!--The following rule will only work when published-->
        <rule name="Construction" stopProcessing="true">
          <match url="Construction\.aspx" negate="true"/>
          <conditions>
            <!-- dont ignore my own ip -->
            <add input="{REMOTE_ADDR}" pattern="XXX.XXX.XXX.XXX" negate="true"/>
          </conditions>
          <action type="Redirect" url="Construction.aspx" redirectType="Found"/>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

</configuration>

It works on IIS on my local machine, but on other machines, I end up with the following problems:

  1. I get a 500 error when the rewrite portion is included. When I remove it everything works fine.
  2. I can't get the debug output to print to the screen.

What's wrong with it?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Cailen
  • 690
  • 1
  • 9
  • 23
  • Do you get any other description to go along with your 500 response code? – Matt Feb 12 '13 at 14:38
  • Nope, nothing. It's not until I remove the portion of my webconfig that the default 500 page is replaced with a debug trace on server errors :/ – Cailen Feb 12 '13 at 18:45

4 Answers4

0

In a case where I use rewrite, I'm not escaping periods in match's url attribute. Have you tried <match url="^Construction.aspx$" negate="true"/>?

Admittedly this is a stretch, as it's been a while since I've dug into the docs for this.

Matt
  • 1,897
  • 4
  • 28
  • 49
  • Nope, nothing. It's not until I remove the portion of my webconfig that the default 500 page is replaced with a debug trace on server errors :/ – Cailen Feb 12 '13 at 18:45
0

I have followed the answer by @CohenA Detailed 500 error message, ASP + IIS 7.5 to help with the full details for 500 errors. I just leave it commented out until I run into an error so I don't have to remember it.


Have you reviewed this answer for the ReWrite issue? Unsure of what you're trying to do with the ReWrite, but perhaps you want to use Rule #2

< match url="^Construction$" />

Or, are you missing the leading / on the ReDirect?

< action type="Redirect" url="/Construction.aspx" redirectType="Found"/>

Community
  • 1
  • 1
Mike A
  • 244
  • 1
  • 10
  • Had to add a space after the code < to get it to display...Hrmmm – Mike A Feb 13 '13 at 14:06
  • It's probably the leading slash on the redirect I bet! I'll check it out later today and get back. – Cailen Feb 13 '13 at 19:10
  • ... No luck. Even just adding an empty under causes the 500 error. – Cailen Feb 14 '13 at 02:22
  • I also tried "~/Construction.aspx" and "../Construction.aspx". Perhaps I don't have the rewrite module installed on IIS? GoDaddy claims it is installed by default though. – Cailen Feb 14 '13 at 18:09
  • Try removing the conditions? Maybe it's case sensitive? I have one redirect with an asterisk * wildcard, but the docs do not indicate that should have mattered in your instance. – Mike A Feb 14 '13 at 21:23
0

I've only gotten as far as adding to the < configuration > tags :

<configSections>
      <sectionGroup name="system.webServer">
           <sectionGroup name="rewrite">
                <section name="rewriteMaps" overrideModeDefault="Allow" />
                <section name="rules" overrideModeDefault="Allow" />
           </sectionGroup>
     </sectionGroup>
</configSections>

so now it doesn't error out, but it also doesn't read the rewrites

tree
  • 728
  • 3
  • 12
  • 22
0

You may try the below config. This has rewrite block which will redirect the requests that come to the folder to an index.php page and will also output the detailed error instead of custom/generic error page. This is tested on Godaddy windows hosting IIS 8.5. Hope this helps!

<configuration>
 <system.webServer>
    <httpErrors errorMode="Detailed"></httpErrors>
    <asp scriptErrorSentToBrowser="true"></asp>
    <rewrite>
     <rules>
      <rule name="your rule" stopProcessing="true">
       <match url="(.*)$"  ignoreCase="false" />
       <conditions>        
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />        
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />        
       </conditions> 
       <action type="Rewrite" url="index.php?request={R:1}"  appendQueryString="true" />
      </rule>
     </rules>
    </rewrite>
  </system.webServer>
  <system.web>
    <customErrors mode="Off"></customErrors>
    <compilation debug="true"></compilation>
  </system.web>
</configuration>
unm
  • 31
  • 3