I am getting error 302 in a single CSS file on an ASP.NET MVC 2 site on a local host this morning, and I donβt know what would change to cause this.
The localhost site uses IIS 7.5, although I had limited experience with IIS, so I did not look at much that could happen there.
CSS file url:
http:
and the location header in the response is as follows:
/MySite/Account/Login?ReturnUrl=%MySite%2fContent%2fSite.css%3fv%3d16&v=16
This makes me think that MVC is redirecting a static file or something like that, however, if that were the case, I would expect all my images, CSS and JavaScript files to do the same thing they did. Just in case, here is a simplified version of RegisterRoutes() in Global.ascx:
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("", "Account/{action}/", new { controller = "Account" }); routes.MapRoute("", "{action}", new { controller = "Home", action = "Index" }); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); routes.MapRoute( "Error", "{*url}", new { controller = "Home", action = "ResourceNotFound" } ); }
Also, if I change the name of my CSS file to Site2.css and refer to it, the same thing will happen.
What's happening?
ajbeaven
source share