asp获取URL参数的几种方法分析总结 <font color=red(2)


If InStr(page,M_Item)=0 Then  
M_ItemUrl = M_ItemUrl & M_Item &"="& Server.URLEncode(Request.QueryString(""&M_Item&"")) 
else 
M_ItemUrl = M_ItemUrl & M_Item &"="& Server.URLEncode(Request.QueryString(""&M_Item&"")) & "&" 
End If  
Next 
Else 
ScriptAddress = ScriptAddress & "?" 
end if  
GetUrl = ScriptAddress & M_ItemUrl  
End Function 

上面的代码得到的地址为
http://dxy.com:8082/test/geturl.asp?Param-VR52tmx3syn03777.html

基本上差不多

如果只是为了得到?号后面的东西,我们可以用下面的代码
复制代码 代码如下:

response.write replace(request.querystring,".html","") 

得到的就是Param-VR52tmx3syn03777是不是满足了我们的需要了呢

PS:上面的所有情况只是针对纯asp,如果结合urlrewrite的话,功能会有所增强,搜索的友好型,也会加强