Event Handlers Might Not Be Not Raised in a Default Document in IIS 7 or IIS 7.5 Integrated Mode?

After pulling my hair out for the last three days in my first non-upgraded ASP.NET 4.0 Web Application, I stumble across this post explaining it all.

http://jai-on-asp.blogspot.com/2010/06/changes-and-differences-between-aspnet.html under the section labeled: Event Handlers Might Not Be Not Raised in a Default Document in IIS 7 or IIS 7.5 Integrated Mode

Apparently, an asp.net page at this address: http://www.mydomain.com/ will not post back to itself without explicitly adding action=”default.aspx” in the <form> tag.

Well, what happens when you are using a Master Page (where the <form> tag is location when using Master Pages)?

How do I get my default.aspx pages to postback to themselves in .NET 4.0 using Master Pages?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Whether the form is specified on the default page, or in the master page, it is still accessible via the Form property on the page.

Therefore, you should be able to set it’s action in the code behind for that page.

protected void Page_Load(object sender, System.EventArgs e)
{
    this.Form.Action = "Default.aspx";
}


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x