日期:2014-05-19  浏览次数:20390 次

asp.net wap
谁做过ASP.NET的WAP网站,我在做的时候为什么后缀名是.ASPX的用M3GATE不能浏览的,而且不能是中文的,一用这些 <%   @Import   Namespace= "System.Data "   %>
<%   @Import   Namespace= "System.Data.SqlClient   "   %>
<%Response.ContentType= "text/vnd.wap.wml ";%>
就出错,到底要怎么做啊,不能用控件做的

------解决方案--------------------
//--以前1.1写的 列子
.aspx只要这一行
<%@ Page language= "c# " Codebehind= "game.aspx.cs " AutoEventWireup= "false " Inherits= "test.game " %>

.cs pageload中

Response.ContentType= "text/vnd.wap.wml ";
Response.ContentEncoding=System.Text.Encoding.UTF8;
System.Text.StringBuilder stringAdd = new System.Text.StringBuilder();
stringAdd.Append( " <?xml version=\ "1.0\ " encoding=\ "utf-8\ " ?> \n ");
stringAdd.Append( " <!DOCTYPE wml PUBLIC \ "-//WAPFORUM//DTD WML 1.1//EN\ " \ "http://www.wapforum.org/DTD/wml_1.2.xml\ "> \n ");
stringAdd.Append( " <wml> \n ");
stringAdd.Append( " <card id=\ "index\ " title=\ "下载乐园\ "> \n ");
stringAdd.Append( " <p> \n ");
string mid = JoyesDB.operaters.operates.getMobileType();
//Response.Write(mid);
if(mid != "False ")
{
string mobileName = " ";
string companyName = " ";
string cid = " ";
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand( "wap_dosql ",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add( "@action ",6);
cmd.Parameters.Add( "@mid ",int.Parse(mid));
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
while(dr.Read())
{
mobileName = dr[ "mobile_name "].ToString();
companyName = dr[ "company "].ToString();
cid = dr[ "company_id "].ToString();
}
dr.Close();
conn.Close();
cmd.Dispose();
conn.Dispose();
stringAdd.Append(mobileName+ "手机游戏 <br/> \n ");
stringAdd.Append( "------------------- <br/> \n ");
stringAdd.Append( " <a href=\ "gamelist.aspx?type=new&amp;mobileName= "+ mobileName + "&amp;companyName= "+ Server.UrlEncode(companyName) + "&amp;cid= "+ cid + "\ "> 最新游戏 </a> \n <br/> \n ");
stringAdd.Append( " <a href=\ "gamelist.aspx?type=hot&amp;mobileName= "+ mobileName + "&amp;companyName= "+ Server.UrlEncode(companyName) + "&amp;cid= "+ cid + "\ "> 热门下载 </a> \n <br/> \n ");
stringAdd.Append( " <a href=\ "gameclass.aspx\ "> 分类浏览 </a> <br/> \n ");
stringAdd.Append( " <a href=\ "gamelist.aspx?type=top&amp;mobileName= "+ mobileName + "&amp;companyName= "+ Server.UrlEncode(companyName) + "&amp;cid= "+ cid + "\ "> 下载总榜 </a> \n <br/> \n ");
}
else
{
stringAdd.Append( "手机游戏 <br/> \n ");
stringAdd.Append( "------------------- <br/> \n ");
stringAdd.Append( "提示:在 <a href=\ "mydomain.aspx\ "> 我的地盘 </a> 设定好所用的手机型号,将能使用更全面的下载服务 <br/> \n ");
}
//stringAdd.Append( " <a href=\ "tollgame.aspx\ "> 百宝箱游戏 </a> \n <br/&