Search code examples
asp.net-mvc-routingasp.net-4.5asp.net-routing

Friendly URLs - caching wrong route


I am using ASP.NET Friendly URLs with a C# asp.net 4.5.1 website on a Windows 2012 Server with IIS implementation.

(this simply and automatically converts aspx pages into nice URLs - eg mydomain.com/mypage.aspx - into mydomain.com/mypage). If a page isn't found the site then falls back to looking for routes. My RouteConfig.cs looks like this...

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

// Firstly Friendly URL's are enabled
routes.EnableFriendlyUrls(settings);
routes.Ignore("{resource}.axd/{*pathInfo}");

// Now a regular root is looked for 
routes.MapPageRoute("route1", "{myroute}/{myroutename}", "~/routepage.aspx");

I tried accessing mydomain/testpage when testpage.aspx DIDNT exist. It routed to mydomain.com/thispage.

I then created testpage.aspx - but now if I try and access mydomain/testpage it still goes to the old route like the page doesn't exist. I've tried restarting the website in IIS, reuploading the RouteConfig.cs file - it still routes wrong.

I've tested on multiple browsers (Chrome & FF on Mac) - all fail. I've tried typing mydomain/testpage.aspx - still routes wrong.

I created a new subdomain for testing - and the page works fine in that.

It's like it's cached somewhere. How can I 'force a refresh' - ie get the newly uploaded page to work?

thanks


Solution

  • Ensure you are uploading the bin folder - this fixed it.