ASP.net 客户端 ID 模式
我的 web.config 中有这样一行:
<pages validateRequest="false" smartNavigation="false" clientIDMode="Static">
这工作正常,我分配给控件的 ID 与代码中的一样。然而,由于某种原因,在实时服务器上,它们都开始使用服务器生成的名称进行渲染,例如:
<input name="ctl00$MainContent$Password2" type="password" maxlength="32" id="Password2" class="nice-textbox" />
有人知道是什么导致它们以这种方式渲染吗?它导致很多页面损坏。
我试图通过 IIS 查找设置以确保它正确加载,但找不到它。
I've got this line in my web.config:
<pages validateRequest="false" smartNavigation="false" clientIDMode="Static">
This was working fine, the Id's I assigned to the controls came out as they were in code. However, for some reason on the live server they have all started rendering with the server generated names such as:
<input name="ctl00$MainContent$Password2" type="password" maxlength="32" id="Password2" class="nice-textbox" />
Anyone know what could be causing them to render this way? It's causing a lot of pages to break.
I'm trying to find the setting via IIS to make sure it's loading it correctly but can't find it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
clientIDMode
是 .NET 4 中的新功能。您的实时服务器的应用程序池未运行 4.0 吗?http://technet.microsoft.com/ en-us/library/cc754523%28v=ws.10%29.aspx
打开 IIS 管理器。有关打开 IIS 管理器的信息,请参阅打开 IIS 管理器 (IIS 7)。
在“连接”窗格中,展开服务器节点并单击“应用程序池”。
在“应用程序池”页面上,选择要为其指定 .NET Framework 版本的应用程序池,然后单击“操作”窗格中的“基本设置”。
单击“确定”。
clientIDMode
is new in .NET 4. Is your live server's application pool not running 4.0?http://technet.microsoft.com/en-us/library/cc754523%28v=ws.10%29.aspx
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
On the Connections pane, expand the server node and click Application Pools.
On the Application Pools page, select the application pool for which you want to specify a .NET Framework version, and then click Basic Settings in the Actions pane.
In the Edit Application Pool dialog box, in the .NET Framework version list, select the version that you want the application pool to use or select No Managed Code if the application uses only native code.
Click OK.