当前位置: 代码迷 >> ASP >> asp 剔除url指定参数
  详细解决方案

asp 剔除url指定参数

热度:87   发布时间:2012-08-17 02:08:34.0
asp 删除url指定参数
我的url是 http://127.0.0.1/index.asp?aaa=1&bbb=2&ccc=3

我要删除aaa后就是

http://127.0.0.1/index.asp?bbb=2&ccc=3

删除bbb就是

http://127.0.0.1/index.asp?aaa=1&ccc=3

代码改怎么写啊 

高手们帮帮忙啊

------解决方案--------------------
这个发错了!!
探讨
http://blog.csdn.net/knife_yu/article/details/6711614

------解决方案--------------------
可以考虑用正则替换
------解决方案--------------------
VBScript code
s = "http://127.0.0.1/index.asp?aaa&bbb=2&ccc=3"
response.write removeQueryParam(s, "bbb")
function removeQueryParam(s, p)
    ar = split(s,"?")
    if ubound(ar) = 0 then
       removeQueryParam = s
    else
       QueryString = ar(1)
       ar2 = split(QueryString, "&")
       for i=0 to ubound(ar2)
           if left(ar2(i), len(p)+1) = p & "=" or ar2(i) = p then
               ar2(i) = ""
           end if
       next
       removeQueryParam = Join(ar2, "&")
       removeQueryParam = replace(removeQueryParam, "&&", "&")
       if left(removeQueryParam, 1) = "&" then
           removeQueryParam = right(removeQueryParam, len(removeQueryParam)-1)
       end if
    end if
end function 
  相关解决方案