I read this excellent post from ScottGu and decided to use it with a page that implemented a masterpage. I didn’t have to use postbacks in my scenario, but there were links included from the masterpage. The problem is that if you use app-relative paths for your href attributes (ex: <a href=”/default.aspx”>) the browser (FF 184.108.40.206 and IE 7 anyways) interperets the url with pathinfo differently than a url without. The base url includes the original page (ex: http://localhost:3333/rewriter.aspx/default.aspx).
Guess what? The webserver picks up the last .aspx extension, default.aspx, that bad boy doesn’t exist, and you get a 404 instead of going to http://localhost:3333/default.aspx.
In the comments, Ian Oxley suggested that you can re-base links in your
page/css/other static files using the
this.Header.Controls.Add(new LiteralControl("<base href=\"" + Request.Url.ToString().Replace(Request.RawUrl, "").Replace(Request.PathInfo, "") + "\">"));
Now the base tag works on both the live site and the one that WebDev.WebServer spins up as well.
[ Currently Playing : Them Bones - Alice in Chains - Nothing Safe: Best of the Box (2:29) ]