now look at here how we can get the Current page URL
< %
function pageurl()
serverName = Request.ServerVariables("SERVER_NAME")
ScriptName = Request.ServerVariables("SCRIPT_NAME")
if Request.ServerVariables("HTTPS") = "on" then secure = "s"
prt = strleft(LCase(Request.ServerVariables("SERVER_PROTOCOL")), "/") & secure
if Request.ServerVariables("SERVER_PORT") = "80" then
port = ""
else
port = ":" & Request.ServerVariables("SERVER_PORT")
end if
pageurl = prt & "://" & serverName & port & ScriptName
end function
%>
Here is a function which will generate pageurl to call this use
<% response.write (pageurl) %>
if page had Querystring you can also retrive that like this
< %
Qstring = Request.ServerVariables("QUERY_STRING")
response.write(pageurl() & "?" & Qstring )
% >
hope it will helps you.
Nice piece of code!!!
ReplyDelete