Fixed Company 404 issues related to ASP.NET

Neuron Games activity blog.

Moderators: Randell of Neuron, Cathy of Neuron

Fixed Company 404 issues related to ASP.NET

PostPosted by Randell of Neuron » Tue Jun 02, 2015 7:40 am

One of the things I hate about internet related tech is that nothing is ever consistent. So for a while we have had nothing handling the 404 errors on our site because we moved from Open BSD to Windows...which means that instead of a .access file you get a web.config file which literally has nothing in common.

Image

I finally figured out that I had to use the site control panel to direct HTML related 404 errors to the 404 page, and use the web.config file separately to handle errors related to ASPX related page requests. It was a pain in the ass but boils down to adding this to your web.config should you be looking for a solution for you ASP.NET websites 404 errors.

Code: Select all
<system.webserver>
     <htperrors>
          <remove statusCode = "401" subStatusCode = "-1" />
          <remove statusCode = "403" subStatusCode = "-1" />
          <remove statusCode = "404" subStatusCode = "-1" />
          <remove statusCode = "500" subStatusCode = "-1" />

          <error statusCode = "401" path"http://www.YourDomain.com/Errors/404.html" responsemode = "ExecuteURL" />
          <error statusCode = "403" path"http://www.YourDomain.com/Errors/404.html" responsemode = "ExecuteURL" />
          <error statusCode = "404" path"http://www.YourDomain.com/Errors/404.html" responsemode = "ExecuteURL" />
          <error statusCode = "500" path"http://www.YourDomain.com/Errors/404.html" responsemode = "ExecuteURL" />
     </htperrors>
</system.webserver>


Don't confuse <system.webServer> with <system.web>, they aren't the same.

Hope this helps someone save 50 hours of looking shit up. Oh, and you might have to set the HTML related error pages to point to the same error file from your internet hosting control panel like I did.
Randell the awesome
Neuron Games, Inc.

Image Image Image Image
User avatar
Randell of Neuron
 
Posts: 22
Joined: Wed May 20, 2015 1:44 am
Location: Earth

Return to Blog

Who is online

Users browsing this forum: No registered users and 1 guest


Style by Gokinstudio | Free forum hosting by ProphpBB | Software by phpBB | Report Abuse | Privacy
cron