迁移:ASP.NET 1.1 到 ASP.NET 2.0,回发中断
我们最近刚刚将 Web 应用程序从 .NET 1.1 迁移到 .NET 2.0。
该 Web 应用程序最初是使用 Visual Studio 2003 在 .NET 1.1 中编写的。为了迁移它,我们将解决方案转换为 VS2005。
除了 RESX 不兼容和日历控件损坏等一些小问题外,Web 应用程序还可以正常工作。
然而,我们今天刚刚测试了一下,一些回发功能突然失效了。 特别是“文件浏览器”之一。 当用户单击浏览按钮时,将打开一个新窗口(自定义页面),允许他浏览文件,然后路径将传递到父页面,然后保存在文本框中,然后它将回发到对路径进行一些验证。 但是,在回发时,存储在文本框中的路径现已消失,并被“默认”路径替换。
从 1.1 迁移到 2.0 时有什么需要注意的地方可能会破坏回发吗?
谢谢! :)
We just recently migrated our web application from .NET 1.1 to .NET 2.0.
The web application was originally written in .NET 1.1 using Visual Studio 2003. To migrate it, we converted the solutions to VS2005.
Aside from some minor problems like RESX incompatibility and broken Calendar Controls, the Web Application worked.
However, we just tested it today and some postback functions are suddenly broken. In particular, the "File Browser" one. When the user clicks on the browse button, a new window will open (a custom page) that will allow him to browse for the file, the PATH will then be passed to the parent page then saved on a textbox, then it will postback to do some validation on the path. However, on POSTBACK, the path that was stored in a textbox is now gone and was replaced by the "default" path.
Is there something that we should watch out for in migrating from 1.1 to 2.0 that can break postbacks?
Thanks! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 ASP.NET 2.0 中的一个设计问题。
我的文本框设置为只读。 此行为是 ASP.NET 2.0 中设计的,其设计理念是只读文本框不应在客户端被恶意代码修改。
解决方法:
您应该在运行时设置,而不是在设计时设置只读属性。
TextBox1.Attributes.Add("只读", "只读");
参考:
http://www.dotnetspider.com/resources/3120-ASP-NET--TextBox-Ready-Only-losing-client-side-changes-values-across-postback.aspx
http://msdn.microsoft.com/en -us/library/system.web.ui.webcontrols.textbox.readonly.aspx
This is a design issue in ASP.NET 2.0.
My textbox was set to readonly. This behaviour is by design in ASP.NET 2.0 and it has been designed with the idea that a ReadOnly TextBox shouldnt be modified in the client side by a malicious code.
Workaround:
Instead of setting the readonly property during design time, you should set in during runtime.
TextBox1.Attributes.Add("readonly", "readonly");
References:
http://www.dotnetspider.com/resources/3120-ASP-NET--TextBox-Ready-Only-losing-client-side-changes-values-across-postback.aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.readonly.aspx