从推荐网址ASP抢参数 [英] ASP grab parameter from referral url
问题描述
我使用的是code,以获得推荐的网址,你可以看到如下:
Hi I am using a code to get the referral URL as you can see below:
sRef = encode(Request.ServerVariables("HTTP_REFERER"))
这code越来越以下网址:的 http://www.rzammit.com/pages/linux-form.asp?adv=101&loc=349
This code is getting the following URL: http://www.rzammit.com/pages/linux-form.asp?adv=101&loc=349
从该网址我想抓住的ADV和LOC(的Request.QueryString不工作)
From that url I want to grab the ADV and LOC (Request.querystring doesnt work)
我如何能做到这一点任何帮助吗?所有这一切是发生在一个脚本。
Any help please on how I can do this? All this is happening in a script.
推荐答案
我无法相信我已经做到了这一点。 ASP经典的是我的第一个网络编程的爱,所以我不得不:)
I can't believe I have done this. ASP Classic IS my first web programming love so I had to :)
<%
URL="http://www.rzammit.com/pages/linux-form.asp?adv=101&loc=349&websync=ert4545445&put=4563"
Response.write ("adv = " + GetVarValue(URL, "adv"))
response.write("<br>")
Response.write ("loc = " + GetVarValue(URL, "loc"))
response.write("<br>")
Response.write ("adv = " + GetVarValue(URL, "websync"))
response.write("<br>")
Response.write ("gput = " + GetVarValue(URL, "gput"))
response.write("<br>")
Response.write ("put = " + GetVarValue(URL, "put"))
response.write("<br>")
%>
<br><br><br>
<%
function GetVarValue(Source, VarName)
pos1 = instr(source, varname + "=")
'to check if the variable was not found
if pos1=0 then
GetVarValue="Not Found!!!"
exit function
end if
pos1 = pos1 + len(varName) + 1
pos2=instr(mid(source,pos1), "&")-1
'to check if it was the last variable
if pos2=-1 then
str1 = mid(source, pos1)
else
str1 = mid(source, pos1, pos2)
end if
GetVarValue=str1
End Function
%>
通过在页面中这个功能你可以通过该变量名称和URL字符串GetVarValue查询任何变量!
With this function in your page you can query any variable by passing the variable name and URL string to GetVarValue!
(PS:如果这个答案的作品,接受这个答案,它会创造奇迹,以我的计算器回购:))
(PS: if this answer works, accept this answer, it will do wonders to my StackOverflow Repo :) )
这篇关于从推荐网址ASP抢参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!