IIS7重写更改默认按钮
我遇到了一个关于母版页和 IIS7 重写模块中的默认按钮的奇怪问题。我的所有内容页面都在代码隐藏中(在预渲染时)设置了默认按钮,或者它们位于 aspx 页面的面板中。这在我的本地计算机和生产服务器上运行良好。但是,当我启用 IIS7 URL 重写时,默认按钮始终位于母版页中的按钮。
protected void LoginButton_PreRender(object sender, EventArgs e)
{
Button btnDefault = sender as Button;
this.Page.Form.DefaultButton = btnDefault.UniqueID;
}
这就是我在代码隐藏中设置默认按钮的方式。我不确定重写模块可以做什么。 感谢您的帮助
I've run into a strange problem regarding default buttons in master pages and IIS7 rewrite module. All my content pages have default buttons set in the code-behind (on prerender), or they are in panels on the aspx page. This works fine on my local machine and on the production server. However, when I enable IIS7 URL Rewrite, the default button is always to the one in the master page.
protected void LoginButton_PreRender(object sender, EventArgs e)
{
Button btnDefault = sender as Button;
this.Page.Form.DefaultButton = btnDefault.UniqueID;
}
That's how I set my default button in the code-behind. I'm not sure what the rewrite module could be doing.
Thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道发布到SO是什么意思,但是经过几个小时的尝试,我弄清楚了......发布后哈哈。好吧,我会将这个问题留给遇到此问题或类似问题的任何人。我将其添加到 web.config 中的规则部分。
.axd 文件是动态生成的,因此您不能对其进行“硬编码”。
I don't know what it is about posting to SO, but after hours and hours of trying, I figure it out...after posting lol. Well, I'll leave the question here for anyone who comes across this, or a similar problem. I added this to the Rules section in the web.config
The .axd files are generated dynamically, so you can't 'hard-code' against it.