The relevant circumstance is that the form action is set to a relative URL in ASP.NET by default:
<form id="ctl01" action="./webform1" method="post">
<!-- ... -->
</form>
If you use the base
tag, you change the base path that the page uses to interpret relative URLs. In your case, the base
URL points to a path that is obviously not able to serve the pages of the application. In order to fix this, I'd reconsider whether the base
tag is necessary. If it is, it should point to a URL that is able to serve the pages of the application. In order to set the base
path to the base path of the application dynamically, you can use the following code:
protected void Page_Load(object sender, EventArgs e)
{
baseCtrl.Attributes["href"] = new Uri(Request.Url, "/").OriginalString;
}
As a work-around if you need to keep the base
tag as it is, I've also tried to set the form
action to an absolute URL by integrating the following code into the master page:
protected void Page_Load(object sender, EventArgs e)
{
Page.Form.Action = Request.Url.OriginalString;
}
This worked in my small sample so that the page could execute the PostBack successfully. Though the form is posted back to the same location as if there was no base
tag, there might be some side-effects because other resources on the page (e.g. CSS, JavaScript files and the like) might also be referenced with a relative URL and therefore be retrieved from another location. So I'd still propose to reevaluate the base
tag before resorting to this solution.