a.htm 有如下表单 <form name="form1" action="Test.aspx" id="form1"> 
        <input name="txt" type="text" id="txt" />
        <input type="submit"/>    
</form>以上默认为Get传输,填入中文"测试"二字,提交后的URL为 http://localhost:1130/Test.aspx?txt=测试
 txt=测试,此处为中文我浏览taobao.com 查询功能,它的html如下:
   <form id="J_TSearchForm" action="http://s.taobao.com/search" name="search" target="_top">
      <input name="q" id="q" autocomplete="off" accesskey="s" />
                <button type="submit">搜索</button>
     </form>随便搜索"手机"二字,提交后的URL是经过编码的,http://s.taobao.com/search?q=%CA%D6%BB%FAq=%CA%D6%BB%FA,此处是经过编辑的
请问在html中通过<form></form>如何实现提交后的Url是经过编码的?

解决方案 »

  1.   

    在aspx.cs中可以通过 Server.UrlEncode()进行编码,然后通过Response.Redirect转向然后通过Server.UrlDecode解码得到值可是在html中如何实现呢
      

  2.   

    "http://localhost:1130/Test.aspx?txt=" + System.Web.HttpUtity.UrlEncode("中文")
      

  3.   

    解码
    HttpUtility.UrlDecode(Request.QueryString["txt"]);
      

  4.   

    感谢楼上两位...但这不是我需要的....
    请仔细看,我是想在 htm 页面里面,作一个“提交”的动作,然后有编码....
    并不是在aspx.cs里面a.html 页面有如下表单 <form name="form1" action="Test.aspx" id="form1"> 
      <input name="txt" type="text" id="txt" />
      <input type="submit"/>  
    </form>