locked
404 error without suffix RRS feed

  • Question

  • User1510859543 posted

    The following links work fine in our production site (web hosting company) but not on our local server.  If I add the suffix .aspx  to the href= settings then pages show on local, otherwise I get 404 - File or directory not found.  How can I correct this?

                <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
                <div class="collapse navbar-collapse navbar-ex1-collapse">
                    <ul class="nav navbar-nav side-nav">
                        <li><a runat="server" href="~/Default">Home</a></li>
                        <li><a runat="server" href="~/Features">Site Features</a></li>
                        <li><a runat="server" href="~/Charlie">Charlie's Story</a></li>
                        <li><a runat="server" href="~/Intro">The Ketogenic Diet</a></li>
                        <li><a runat="server" href="~/Registration">Register</a></li>
                    </ul>
                </div>
    

    Tuesday, September 26, 2017 5:14 PM

Answers

  • User-271186128 posted

    Hi dlchase,

    The issue might relate to the "friendly URLs" mechanism. You could deactivate them by changing the code in App_Start\RouteConfig.cs from:

    var settings = new FriendlyUrlSettings();
    settings.AutoRedirectMode = RedirectMode.Permanent;
    routes.EnableFriendlyUrls(settings);

    to:

    var settings = new FriendlyUrlSettings();
    settings.AutoRedirectMode = RedirectMode.Off;
    routes.EnableFriendlyUrls(settings);

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 27, 2017 8:10 AM

All replies

  • User-271186128 posted

    Hi dlchase,

    The issue might relate to the "friendly URLs" mechanism. You could deactivate them by changing the code in App_Start\RouteConfig.cs from:

    var settings = new FriendlyUrlSettings();
    settings.AutoRedirectMode = RedirectMode.Permanent;
    routes.EnableFriendlyUrls(settings);

    to:

    var settings = new FriendlyUrlSettings();
    settings.AutoRedirectMode = RedirectMode.Off;
    routes.EnableFriendlyUrls(settings);

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 27, 2017 8:10 AM
  • User1510859543 posted

    Correct.  I had the lines commented out.

    Wednesday, September 27, 2017 1:27 PM