简体   繁体   中英

How can I stop IIS from redirecting every request to remove the .aspx ending?

I created a new project (Web Application, C#, ASP.NET 4.5) in VS 2015 and I do not want my site to use FriendlyURLs at all. I would like to see .aspx in the browser when I visit my site.

I removed FriendlyURLs using the NuGet package manager. I also removed all the references and the Redirect code from the project. The site, though, still continues to redirect each request from /Default.aspx to /Default.

Is there a way to stop IIS or VS from doing that?

The only solution for me was to create a whole new website (on filesystem in my case) and copy all the files from the "corrupted" site to this new one. No changes were done to the original files and the problem disappeared. This is not a good solution, but I did not found any other :-(

For my opinion this behavior is caused by previous 301 redirecting in browser. I use MSIE, but it cache 301 probably forever. Using another browser can by solution for this or find the way, how to clear redirection cache.

This could potentially be a caching issue with your browser and IIS .

If you've used a project with Microsoft.ASPNet.FriendlyUrls and it's removed the .aspx extension and you've opened another Webforms project Chrome will cache the removal of the .aspx extensions.

You will need to clear the cache if this is indeed the issue (you can try using incognito mode first to see if this is actually the issue).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM