c# - Disable removal of ASPX extension -


i created c# application in visual studio hosted on iis 7.5. accessing application's aspx files directly results automatic removal of extension (the pages rendered correctly).

for example, when accessing following url: http://www.example.com/contact.aspx

the following url returned server: http://www.example.com/contact

i configure application accessing aspx file extension result returned url containing extension.

there no <rewrite> tag in web.config.

global.asax content:

<%@ application language="c#" %> <%@ import namespace="website2" %> <%@ import namespace="system.web.optimization" %> <%@ import namespace="system.web.routing" %>  <script runat="server">      void application_start(object sender, eventargs e)     {         routeconfig.registerroutes(routetable.routes);         bundleconfig.registerbundles(bundletable.bundles);     }  </script> 

routeconfig.cs content:

using system; using system.collections.generic; using system.web; using system.web.routing; using microsoft.aspnet.friendlyurls;  namespace website2 {     public static class routeconfig     {         public static void registerroutes(routecollection routes)         {             var settings = new friendlyurlsettings();             settings.autoredirectmode = redirectmode.permanent;             routes.enablefriendlyurls(settings);         }     } } 

thanks.

routeconfig.cs file defines how routing works in web application.

just remove code related friendlyurlsettings , should work expected.

        public static void registerroutes(routecollection routes)         {             var settings = new friendlyurlsettings();             settings.autoredirectmode = redirectmode.permanent;             routes.enablefriendlyurls(settings);         } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -