RewritePath issue on ASP.NET 4

by Marius Gheorghe 24. June 2011 09:25

  Ported a app from ASP.NET 2 and 4 and had a interesting issue with HttpContext.RewritePath.  Basically I was doing url rewriting using to ashx handler to get nice urls on asp.net 2. When I moved the app to 4 all postbacks on pages with rewritten url were broken (even if I was running the app with the backward compatible settings).

Found a workaround (not perfect but it gets he job done). Basically RewritePath has a parameter called “rebaseClientPath” which “updates” the path after url change. This rebase doesn’t seem to work anymore on ASP.NET 4 so make sure it set the param value to false.

Hope this helps someone.

Tags:

dotNET