Custom404page and Extensionless Url setting

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
10/29/2013 1:55:32 PM
Gravatar
Total Posts 19

Custom404page and Extensionless Url setting

I was to start out saying I'm not sure if this is a bug or just something I stumbled across with our sites.

I am running Mojoportal 2.3.9.4 on my local computer.

I start out by setting the <add key="Custom404Page" value="/PageNotFound.aspx" /> in my user.config so that any page someone tries to go to that is not a real page directs them to a styled page in place of the 404 error. How ever this only works if they are trying to go to a .aspx page (example: "parkinglot.aspx"). should they try and type in an address or be linked to an address that ends with out the ".aspx"(example: "parkinglot/" they will get a server error or in my case a "IIS 7.5 Detailed Error - 404.0 - Not Found" 

To correct this error I use the setting <add key="DetectPageNotFoundForExtensionlessUrls" value="true" /> also in my user.config. now when a user goes to a page that is not a real page if it ends in "/parkinglot.aspx" or just a word like "/parkinglot/" the user is directed to a styled page in place of the 404 error.

The problem happens once the new key is added, the "<add key="DetectPageNotFoundForExtensionlessUrls" value="true" />", you can no longer type "/admin/" after the root of the site(example: www.mojoportal.com/admin/) to get to the admin log in page or to the admin menu. 

My question is, should you still be able to get to the admin/ page when the <add key="DetectPageNotFoundForExtensionlessUrls" value="true" /> has been added to the user.config or was that functionality never intended?

 

10/29/2013 3:02:57 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Custom404page and Extensionless Url setting

In order to "bridge the gap" to show the 404 error for everything, not just the pages mojoPortal recognizes, you can make a modification to your web.config so that IIS will use PageNotFound.aspx for all incoming requests. It's commented out by default, because certain configurations/versions of IIS may have trouble with it. The section is near the bottom of web.config, and here is how we have it configured in our installation:

      <!-- Info about custom error configuration: http://msdn.microsoft.com/en-us/library/ms690497.aspx
         It's commented out below, because by default IIS7 has this locked down at a parent config
         file, probably machine.config -->
      <!--
     <httpErrors errorMode="DetailedLocalOnly" defaultResponseMode="ExecuteURL" defaultPath="Error.htm">
     -->
        <httpErrors>
      <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/PageNotFound.aspx" responseMode="ExecuteURL"/>
    </httpErrors>

 

You must sign in to post in the forums. This thread is closed to new posts.