locked
VS 2015 Changing URL Extensions RRS feed

  • Question

  • User1812630098 posted

    I am using VS 2015 and creating websites with a VB backend. The site is to replace one that I created in VS 2012 that is in production and works fine.

    Upon deploying it to an Apache/IIS hybrid hosting site, the URL extensions are removed when calling the pages. Due to the call going to an Apache server, the Apache server recognizes the .aspx extension for the page it is looking for, and passes it along to the IIS server (which is setup to handle ASP.NET).

    Something in VS 2015 is rewriting the URL so that it is only passing Default instead of Default.aspx along so I get error 404 (Page not Found).

    The hosting site says that it is not their servers that is truncating the page request, yet rather something in the code that I am publishing. I know that the standard is to remove the URL extension, but in this case I want to keep them so that the page request works correctly with this hybrid server setup my hosting site has.

    I cannot find what the code is in the VS 2015 project that is calling the rewrite. Does anyone know where I might find this code so that I can remove it?

    Friday, April 22, 2016 1:52 AM

Answers

  • User1812630098 posted

    Angie,

    Thanks for the thought, but they have advised me that this is a coding error.

    So I made a change to the FriendlyURL settings in the RouteConfig.vb file:

    settings.AutoRedirectMode = RedirectMode.Off

    This seems to have fixed the URL rewrite. Need to figure out why my site.master page isn't loading at this time. Thanks for the replies.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 2, 2016 2:34 AM

All replies

  • User-166373564 posted

    Hi,

    Something in VS 2015 is rewriting the URL so that it is only passing Default instead of Default.aspx along so I get error 404 (Page not Found).

    For this issue, it's recommended to look into the rewrite rule in IIS:

    1. Go to IIS Manager.
    2. Select Default Web Site.
    3. In the Feature View click URL Rewrite.

    Please follow this guide to check Rewrite Rules for the URL Rewrite Module.

    Have a good day.

    Angie

    Saturday, April 23, 2016 2:13 AM
  • User1812630098 posted

    Thanks for the reply. Unfortunately, I do not have access to the IIS server as it is at a hosting company.

    I was capable of figuring out that the NuGet package FriendlyUrl is doing the rewrite of the sites URL's. Now I just have to figure out how to disable it.

    Saturday, April 23, 2016 6:20 PM
  • User-166373564 posted

    Hi,

    I was capable of figuring out that the NuGet package FriendlyUrl is doing the rewrite of the sites URL's. Now I just have to figure out how to disable it.

    You could also consider contacting your hosting provider, they can help you on this issue.

    Have a good day.

    Angie

    Tuesday, April 26, 2016 8:52 AM
  • User1812630098 posted

    Angie,

    Thanks for the thought, but they have advised me that this is a coding error.

    So I made a change to the FriendlyURL settings in the RouteConfig.vb file:

    settings.AutoRedirectMode = RedirectMode.Off

    This seems to have fixed the URL rewrite. Need to figure out why my site.master page isn't loading at this time. Thanks for the replies.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 2, 2016 2:34 AM