Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
611 views
in Technique[技术] by (71.8m points)

asp.net - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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";
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...