获取页面的当前 url(使用 URL Rewrite) [英] get current url of the page (used URL Rewrite)
问题描述
我正在开发经典的 asp 应用程序.我在某些页面上使用了 URL 重写.
I am working on classic asp application. I have use URL rewrite on some pages.
如何在经典asp中获取页面的当前url?
How can i get current url of the page in classic asp?
示例:http://www.site.com/page.asp ---> IIS 中的 url 重写---> http://www.site.com/home/page
Example: http://www.site.com/page.asp ---> url rewrite in IIS ---> http://www.site.com/home/page
所以在这里我想要页面的当前网址 http://www.site.com/home/页面
so here i want current url of the page which is http://www.site.com/home/page
请帮助我.谢谢.
推荐答案
你可以尝试像这样输出所有的ServerVariables:
You can try to output all ServerVariables like so:
for each key in Request.Servervariables
Response.Write key & " = " & Request.Servervariables(key) & "<br>"
next
也许您寻找的网址已经存在.我们使用 Rewrite 模块,并且有一个名为 HTTP_X_ORIGINAL_URL
的 ServerVariable 包含重写的 URL 路径,例如在您的示例中为/home/page".
Maybe the URL you seek is already there. We use the Rewrite module and there is a ServerVariable called HTTP_X_ORIGINAL_URL
that contains the rewritten URL path, e.g. "/home/page" in your example.
协议 (HTTPS=ON/OFF
) 和服务器 (SERVER_NAME
) 也可以在 ServerVariables 中找到.
Protocol (HTTPS=ON/OFF
) and Server (SERVER_NAME
) can also be found in the ServerVariables.
这篇关于获取页面的当前 url(使用 URL Rewrite)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!