Hi all!
This is my setup:
- IIS6 on Windows Server 2003
- iirf URL rewriter
- mapped .mvc extension to handle MVC pages (unchecked verify that file exists)
- no jolly catch-all handler
IIRF rewrites with the following rule (there is more, but it all boils down to this one, as far as MVC is concerned):
RewriteRule /(.*) /mvc.mvc/$1 [I,L]
Now, the problem: Html.ActionLink() produces nice links. Html.BeginForm() produces links which include "mvc.mvc".
Example: Html.ActionLink("test", "MyAction") produces: a href="/MyController/MyAction". But Html.BeginForm() produces action="/mvc.mvc/MyController/MyAction".
Why is that? Any hints to have BeginForm act similarly to ActionLink?
In case it matters, this is the final piece to make it work:
protected void Application_BeginRequest(Object sender, EventArgs e) {
HttpApplication app = sender as HttpApplication;
if (app != null)
if (app.Request.AppRelativeCurrentExecutionFilePath == "~/mvc.mvc")
app.Context.RewritePath(
app.Request.Url.PathAndQuery.Replace("/mvc.mvc", "")
);
}