检测经典ASP中的Server.Transfer

时间:2022-05-17 05:15:29

In Classic ASP, how do you detect on that the page got control via a Server.Transfer()?

在Classic ASP中,如何检测页面是否通过Server.Transfer()获得控制权?

I cannot compare the URL vs the current ASP filename because the code is stored in a library (included).

我无法比较URL与当前ASP文件名,因为代码存储在库(包含)中。

2 个解决方案

#1


You can check if Request.ServerVariables("URL") matches the current page. For a Server.Transfer the URL is still the original page that was requested.

您可以检查Request.ServerVariables(“URL”)是否与当前页面匹配。对于Server.Transfer,URL仍然是请求的原始页面。

In response to your edit: The page needs to provide the current page name to the code in the library, otherwise the library has nothing that it can compare the requested URL to.

响应您的编辑:页面需要为库中的代码提供当前页面名称,否则库没有任何可以比较请求的URL的内容。

#2


There is no way to acheive this without some assistance from the page calling Transfer or the page to which execution is transfered. Probably the latter would be the best place to do this and tweak the library code to accept details from it about the transfer (if any).

如果没有页面调用Transfer或传输执行页面的帮助,则无法实现此目的。可能后者是最好的地方,并调整库代码,以接受有关转移的详细信息(如果有的话)。

#1


You can check if Request.ServerVariables("URL") matches the current page. For a Server.Transfer the URL is still the original page that was requested.

您可以检查Request.ServerVariables(“URL”)是否与当前页面匹配。对于Server.Transfer,URL仍然是请求的原始页面。

In response to your edit: The page needs to provide the current page name to the code in the library, otherwise the library has nothing that it can compare the requested URL to.

响应您的编辑:页面需要为库中的代码提供当前页面名称,否则库没有任何可以比较请求的URL的内容。

#2


There is no way to acheive this without some assistance from the page calling Transfer or the page to which execution is transfered. Probably the latter would be the best place to do this and tweak the library code to accept details from it about the transfer (if any).

如果没有页面调用Transfer或传输执行页面的帮助,则无法实现此目的。可能后者是最好的地方,并调整库代码,以接受有关转移的详细信息(如果有的话)。