谁能解决要请吃大餐了,关于ASP.NET做移动网站
代码很简单aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test4.aspx.cs" Inherits="test4" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:Form id="Form1" runat="server">
<mobile:TextBox ID="TextBox1" Runat="server">
</mobile:TextBox>
<mobile:Command ID="Command1" Runat="server" OnClick="Command1_Click">Command</mobile:Command>
</mobile:Form>
</body>
</html>
.cs:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text =DateTime.Now.ToString("yyyy-MM-dd");
}
protected void Command1_Click(object sender, EventArgs e)
{
Response.Redirect("qrtest.aspx");
}
但是在实际测试时,单击按钮有时正常,有时就会报“请求内容未找到”的错误,服务器事件查看器得到的错误信息如下:
事件代码: 3005
事件消息: 发生了未处理的异常。
事件时间: 2009-3-26 12:37:17
事件时间(UTC): 2009-3-26 4:37:17
事件 ID: 7c389e140b8c40f5ae63846be82080bc
事件序列: 44
事件匹配项: 1
事件详细信息代码: 0
应用程序信息:
应用程序域: /LM/W3SVC/1/Root/wap-1-128825156251406250
信任级别: Full
应用程序虚拟路径: /wap
应用程序路径: E:\web\wap\
计算机名: WD
进程信息:
进程 ID: 2176
进程名: w3wp.exe
帐户名: NT AUTHORITY\NETWORK SERVICE
异常信息:
异常类型: FormatException
异常消息: Base-64 字符数组的无效长度。
请求信息:
请求 URL: http://×.×.×.×/wap/test4.aspx?__ufps=340913&t=48721
请求路径: /wap/test4.aspx
用户主机地址: 211.140.18.130
用户:
是否已经过身份验证: False
身份验证类型:
线程帐户名: NT AUTHORITY\NETWORK SERVICE
线程信息:
线程 ID: 1
线程帐户名: NT AUTHORITY\NETWORK SERVICE
是否正在模拟: False
堆栈跟踪: 在 System.Convert.FromBase64String(String s)
在 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
在 System.Web.UI.LosFormatter.Deserialize(String input)
在 System.Web.UI.MobileControls.MobilePage.LoadPageStateFromPersistenceMedium()
在 System.Web.UI.Page.LoadAllState()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
但是只要把page_load里面的 TextBox1.Text =DateTime.Now.ToString("yyyy-MM-dd");
赋值语句拿掉,就百分百正常。
--------------------编程问答-------------------- 加个 !IsPostBack 试试 --------------------编程问答-------------------- --------------------编程问答--------------------
错误照旧 --------------------编程问答-------------------- --------------------编程问答-------------------- web.config 加入 试试
<deviceFilters>
<filter name="isJPhone" compare="Type" argument="J-Phone"/>
<filter name="isHTML32" compare="PreferredRenderingType" argument="html32"/>
<filter name="isWML11" compare="PreferredRenderingType" argument="wml11"/>
<filter name="isCHTML10" compare="PreferredRenderingType" argument="chtml10"/>
<filter name="isGoAmerica" compare="Browser" argument="Go.Web"/>
<filter name="isMME" compare="Browser" argument="Microsoft Mobile Explorer"/>
<filter name="isMyPalm" compare="Browser" argument="MyPalm"/>
<filter name="isPocketIE" compare="Browser" argument="Pocket IE"/>
<filter name="isUP3x" compare="Type" argument="Phone.com 3.x Browser"/>
<filter name="isUP4x" compare="Type" argument="Phone.com 4.x Browser"/>
<filter name="isEricssonR380" compare="Type" argument="Ericsson R380"/>
<filter name="isNokia7110" compare="Type" argument="Nokia 7110"/>
<filter name="prefersGIF" compare="PreferredImageMIME" argument="image/gif"/>
<filter name="prefersWBMP" compare="PreferredImageMIME" argument="image/vnd.wap.wbmp"/>
<filter name="supportsColor" compare="IsColor" argument="true"/>
<filter name="supportsCookies" compare="Cookies" argument="true"/>
<filter name="supportsJavaScript" compare="Javascript" argument="true"/>
<filter name="supportsVoiceCalls" compare="CanInitiateVoiceCall" argument="true"/>
</deviceFilters> --------------------编程问答-------------------- 没有搞过移动的开发,关注 --------------------编程问答-------------------- TextBox1.Text ='asd';
试试这样行不行 --------------------编程问答-------------------- 试试:
1.在客户端直接加链接:<a href='qrtest.aspx'>按钮</a>
2.用<mobile:TextBox ID="TextBox1" Text='<%=DateTime.Now.ToString("yyyy-MM-dd")%>' Runat="server">
</mobile:TextBox>
不用这个:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text =DateTime.Now.ToString("yyyy-MM-dd");
}
--------------------编程问答-------------------- TextBox1.Text =System.DateTime.today.ToString("yyyy-MM-dd") --------------------编程问答-------------------- 没有搞过移动开发,帮顶 --------------------编程问答-------------------- 没有开发过移动的东西 --------------------编程问答-------------------- http://www.cnblogs.com/hongweiqu/archive/2007/12/14/995022.html --------------------编程问答-------------------- 不支持格式 --------------------编程问答--------------------
1链接肯定是没问题的
2 <mobile:TextBox ID="TextBox1" Text=' <%=DateTime.Now.ToString("yyyy-MM-dd")%>'
这样是无效的 --------------------编程问答--------------------
这个加过的 --------------------编程问答--------------------
错误照旧 --------------------编程问答-------------------- 是否有某些类没有引入 --------------------编程问答-------------------- System.Web.Mobile
System.Web.UI.MobileControls
System.Web.UI.MobileControls.Adapters --------------------编程问答--------------------
???啥意思 --------------------编程问答-------------------- 应该不会吧,因为有时正常,有时错误 --------------------编程问答-------------------- 1.为什么不用链接?
2.这个试试:Server.Transfer --------------------编程问答--------------------
我需要传值,链接没办法获取文本框的内容
--------------------编程问答-------------------- 顶下啊 --------------------编程问答-------------------- 在html视图中按如下设置:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:Form id="Form1" runat="server">
<mobile:Panel ID="Panel1" Runat="server">
<mobile:DeviceSpecific ID="DeviceSpecific1" Runat="server">
<Choice Argument="html32" Filter="isHTML32">
<ContentTemplate>
<mobile:TextBox ID="TextBox1" Runat="server"></mobile:TextBox>
<mobile:Command ID="Command1" Runat="server" OnClick="Command1_Click">Command</mobile:Command>
</ContentTemplate>
</Choice>
</mobile:DeviceSpecific>
</mobile:Panel>
</mobile:Form>
</body>
</html>
--------------------编程问答--------------------
后台找不到TextBox1。。。。。。。 --------------------编程问答-------------------- up --------------------编程问答-------------------- 1、确保路径正确
2、确保传值正确
--------------------编程问答-------------------- TextBox1.Text =System.DateTime.today.ToString("yyyy-MM-dd")
这样拉 --------------------编程问答-------------------- 没搞过移动开发
关注!!! --------------------编程问答--------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:Form id="Form1" runat="server">
<mobile:TextBox ID="TextBox1" Runat="server"></mobile:TextBox>
<mobile:Command ID="Command1" Runat="server" OnClick="Command1_Click">Command</mobile:Command>
</mobile:Form>
</body>
</html>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.MobileControls.MobilePage
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = DateTime.Now.ToString("yyyy-MM-dd");
}
protected void Command1_Click(object sender, EventArgs e)
{
Response.Redirect("http://sports.163.com");
}
}
以上是经过我多次调试无误的代码,如果楼主照此做还有问题,估计就是楼主的电脑系统存在某种问题!!! --------------------编程问答--------------------
--------------------编程问答--------------------
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostback)
{
TextBox1.Text =DateTime.Now.ToString("yyyy-MM-dd");
}
}
protected void Command1_Click(object sender, EventArgs e)
{
Response.Redirect("~/qrtest.aspx");
}
IE测试当然没问题,我是在用手机测试,索爱M608 诺基亚N91 测试都没问题,用了一个山寨机来测试,就是有时能通过,有时会报错。 --------------------编程问答-------------------- 请问楼主是否确认qrtest.aspx页面有无问题?? --------------------编程问答--------------------
真佩服楼主,连山寨机都拿来作为测试对象,楼主考虑的面实在是广! --------------------编程问答--------------------
就空白页面 --------------------编程问答--------------------
呵呵,你可以去调查下现在用山寨的有多少用户 --------------------编程问答--------------------
这个是对的 --------------------编程问答-------------------- 继续寻找解决方案 --------------------编程问答-------------------- 555555555555555555555 --------------------编程问答-------------------- 顶下 LZ --------------------编程问答-------------------- 顶下 LZ --------------------编程问答-------------------- 估计机子问题
补充:.NET技术 , ASP.NET