从移动设备查看的 ASP.NET 页面上的回发问题
我面临着一个尴尬的问题。我正在开发一个 .NET 网站,我们也正在为其制作移动版本。当我从笔记本电脑上的浏览器查看时,移动版本似乎工作正常,但是当从移动设备(在我的情况下是在 Android 上运行的 HTC)查看时,按钮点击出现问题。回发只是冻结页面,并在一段时间后显示“网页不可用”
。即使对于仅与 Response.Redirect 关联的简单取消按钮也是如此。
有人目睹过类似的情况吗?关于什么可能导致这种情况的任何想法?我正在使用.NET 3.5。
I am facing an awkward problem. I am working on a .NET web site for which we are making a mobile version as well. The mobile version seems to be working fine when I am viewing it from the browser on my laptop, but when viewing it from a mobile device (in my case HTC running on Android), there is a problem on button clicks. The postbacks simply freeze the page and after some time "Web page not available"
is displayed. Even for simple cancel buttons that only have Response.Redirect
associated with them.
Has anyone witnessed similar situation? Any ideas on what can cause this? I am using .NET 3.5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
回发通过插入的 JavaScript
(__doSubmit
) 进行。移动设备对 JavaScript 的支持不完整。是否可以通过连接到 WURFL 数据库 来查看设备功能,并查看设备功能。我完全可以想象这对于低端设备来说会是一个问题,但我对 HTC Andriod 设备感到有点惊讶。另外,为了帮助隔离问题,我将使用普通的提交按钮进行测试,即没有runat="server"
的按钮,然后看看会发生什么。您也可以尝试颠覆您的按钮并放入一些自定义 JavaScript 来提交 ie
这个链接有一些类似的问题,但自动提交下拉列表
也有可能膨胀的
ViewState
导致回发时页面大小出现问题。一般来说,如果/当我一直在为移动设备开发时,如果可能的话我会关闭它。生成的页面将比需要的大(大得多)。如果没有其他事情,您需要尽一切努力使页面尽可能小(恕我直言),我假设您此时已被锁定在 Webforms 开发中 - 所以您可以查看 ASP.Net 移动控件,看看它们是否表现得更好 - 那里有一个表单控件。但我从未使用过它们,也从未见过它们被使用。其他一些海报可能已经取得了巨大的成功?也许?
没有帮助,但是当我们为移动设备开发时,我们使用了 MVC,它至少在这种情况下更加透明
The postbacks work through inserted JavaScript
(__doSubmit
). Mobile devices have patchy support for JavaScript. Is it possible to look at the device capabilities for instance by hooking into a WURFL database and look at the device capabilities. I could well imagine that this would be a problem for lower end devices but I am a bit surprised about HTC Andriod devices. Also to help isolate the issue I would test with a normal submit button i.e. one withoutrunat="server"
and see what happens thenAlso you could try subverting your button and putting in some custom javascript to submit i.e.
This link has some similar problems but with autosubmitting drop down lists
It's also dimly possible that the swollen
ViewState
is causing issues with the page size on postback. Generally if/when I have been developing for mobile I would turn this off if possible. The resulting page will be larger (a lot larger) than it needs to be. If nothing else you would need to make every effort to keep the pages as small as possible (IMHO)I'm assuming that you are locked into webforms development at this point -so you could look at ASP.Net mobile controls to see if they behave better - there is a form control in there. But I have never used them or ever seen them used. Some other posters may have had great success with them though? Perhaps?
Not helpful but when we developed for mobile we used MVC which is at least more transparent in these kind of situations