检测链接用户是否单击以转到.ASP页 [英] Detect link user had clicked on to get to an .ASP page
问题描述
我是Visual Studio的新手,但不是Visual Basic.我很满意它,并且在我使用VB6和早期版本构建机器控制应用程序的那一天就可以与数据库进行交互.我刚刚在VS-VB 2010中完成了一个大型应用程序,但是该应用程序在计算机本地运行.
我要解决的下一个项目就是这样.网站上的链接会将用户定向到我将要运行的.ASP服务器.从那里,根据来自用户的链接,该链接将被重定向到新的网页.
我可以通过在使用IIS的Vista开发计算机上运行的.ASP文本页面来实现此目的.
(http://XX.XX.XX.XX/index.asp是服务器上的链接/文件名)
< HTML>
< BODY>
< img src ="http://XX.XX.XX.XX/logo.gif" width ="100" height ="50" alt =徽标">
< p>一刻...</p>
<%
Response.Redirect("http://www.newwebpage.com/page.htm")
%>
</BODY>
</HTML>
这很好用.但是,我需要构建代码来检测用户的来源,例如http://XX.XX.XX.XX/12345.我知道,如果我可以检测到用户单击的地址,那么我可以看到在数据库中,然后建立重定向.
还是我需要为每个具有重定向的链接构建页面?除了我想处理的事情之外,还有很多事情是我认为最好的方法是基于该链接查找数据库.
或者,.ASP是否不是为此的解决方案?
谢谢!
I am new to Visual Studio, but not Visual Basic. I am very comfortable with it, and interaction with a database from my days building machine control apps in VB6 and prior versions. I’ve just completed one large application in VS-VB 2010, but it ran local to the machine.
My next item to tackle is like this. A link on a website will direct the user to an .ASP server I will be running. From there, depending on the link that it came from the user will be redirected to a new webpage.
I can make this happen with an .ASP text page running on a Vista Development machine using IIS.
(http://XX.XX.XX.XX/index.asp is the link/filename on the server)
<HTML>
<BODY>
<img src="http://XX.XX.XX.XX/logo.gif" width="100" height="50" alt="Logo">
<p>One Moment...</p>
<%
Response.Redirect("http://www.newwebpage.com/page.htm")
%>
</BODY>
</HTML>
This works great. But, I need to build code that can detect where the user came from, such as http://XX.XX.XX.XX/12345.I know that if I could detect the address they had clicked on, I could look that up in a database and then build the redirect.
Or do I need to build pages for each link that will have a redirect? There are more than I’d like to deal with and feel that a database look up based on that link would be best.
Or, is .ASP not the solution for this?
Thank you!
推荐答案
您最好的选择是将要重定向的页面作为查询字符串参数传递给URL.但是,Request.ServerVariables("HTTP_REFERER")会为您提供引用URL.
Your best bet is to pass the page you want to redirect to on the URL as a query string parameter. Request.ServerVariables("HTTP_REFERER") will give you the referring URL, however.
这篇关于检测链接用户是否单击以转到.ASP页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!