Search code examples
.netasp.netproxyurl-rewritingisapi-rewrite

Changing Urls on ASP.NET form with Master pages


We've had a requirement from a client to move a site that is running on it's own domain to a subfolder of another app.

I've acheived this using ISAPI rewrite proxying.

However, there is one form that does a post back in the site. The generated url for the action from ASP.NET is "/sign-up.aspx?". This sends the postback to the root of the site.

I want to change this to "sign-up.aspx?" (no leading slash). This would be fine if I wasn't using Master pages as I could get a reference to the form and change it's action (this is .NET 3.5 SP1). I've tried to use the following code in my control to get a reference to the form but it doesn't seem to do anything. It finds the form but the action is not set to the value.

        HtmlForm form = ControlLocator.FindControl<HtmlForm>(Page.Master.Master, "form1");
        form.Action = "sign-up.aspx?";

This is in Page_Load and ControlLocator.FindControl is a port of this http://www.west-wind.com/Weblog/posts/5127.aspx

Any ideas?

Cheers, Rob


Solution

  • Eventually figured out that it was umbraco's Form.browser that was rewriting the post back url after I had changed it. (Apologies for not mentioning the use of umbraco in my original question).