IIS7重写更改默认按钮

发布于 2024-08-30 05:16:22 字数 412 浏览 5 评论 0原文

我遇到了一个关于母版页和 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

成熟的代价 2024-09-06 05:16:22

我不知道发布到SO是什么意思,但是经过几个小时的尝试,我弄清楚了......发布后哈哈。好吧,我会将这个问题留给遇到此问题或类似问题的任何人。我将其添加到 web.config 中的规则部分。

<add input="{URL}" negate="true" pattern="\.axd$" />

.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

<add input="{URL}" negate="true" pattern="\.axd$" />

The .axd files are generated dynamically, so you can't 'hard-code' against it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文