我的程序如:
page1.aspx:
<script language=javascript>
function check(string system,string type,string name)
{
   this.location="page2.aspx?system="+system+"&type="+type+"&name="+name+"";
}
</script>page2.aspx
string system=Request.Querystring("system");
string type=Request.Querystring("type");
string name=Request.Querystring("name");其中我在page1中type参数的具体值是abc#def,结果我在page2中就接不到name的值了,而且type
的值也只接到了1半,就是abc.

解决方案 »

  1.   

    Server.UrlEncode
    Server.UrlDecode
      

  2.   

    encodeURIpage1.aspx:
    <script language=javascript>
    function check(string system,string type,string name)
    {
       this.location = "page2.aspx?system=" + encodeURI(system) + "&type=" + encodeURI(type) + "&name=" + encodeURI(name);
    }
    </script>page2.aspx
    string system = Server.UrlDecode(Request.Querystring["system"]);
    string type = Server.UrlDecode(Request.Querystring["type"]);
    string name = Server.UrlDecode(Request.Querystring["name"]);
      

  3.   

    encodeURI 方法
    将文本字符串编码为一个有效的统一资源标识符 (URI)。encodeURI(URIString)必选的 URIString 参数代表一个已编码的 URI。说明
    encodeURI 方法返回一个编码的 URI。如果您将编码结果传递给 decodeURI,那么将返回初始的字符串。encodeURI 方法不会对下列字符进行编码:":"、"/"、";" 和 "?"。请使用 encodeURIComponent 方法对这些字符进行编码。decodeURI 方法
    返回一个已编码的统一资源标识符 (URI) 的非编码形式。decodeURI(URIstring)必要的 URIstring 参数代表一个已编码 URI 的值。说明
    使用 decodeURI 方法代替已经过时的 unescape 方法。decodeURI 方法返回一个字符串值。如果 URIString 无效,那么将产生一个 URIError。