URL rewriting breaks ASP.NET 2's themes
If you try to use URL rewriting and ASP.NET 2 themes at the same time, you will likely get broken pages, because the two don't mix very well.
A typical link to a theme's stylesheet looks like this in the generated HTML:
<link href="App_Themes/Theme1/StyleSheet.css" type="text/css" rel="stylesheet" />
The problem is that these links to CSS documents are using relative paths, which is not going to work fine if you use RewritePath on your web requests.
Update: as Scott and Wilco wrote in comments, a much simpler solution is to use the new overload of the RewritePath method that takes one additional parameter named "rebaseClientPath".
Thomas Bandt has a solution, described in German (the source is available), that relies on response filters.
Here is another solution I use. It consists on overriding the Render method in a base page or in a master page:
protected override void Render(HtmlTextWriter writer)
{
foreach (Control control in Page.Header.Controls)
{
HtmlLink link;
link = control as HtmlLink;
if ((link != null) && link.Href.StartsWith("~/"))
{
if (Request.ApplicationPath == "/")
link.Href = link.Href.Substring(1);
else
link.Href = Request.ApplicationPath+"/"+link.Href.Substring("~/".Length);
}
}
base.Render(writer);
}