views:

326

answers:

2

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

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

A: 

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.

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.

Guffa
Library code will not have any details about the calling page in order to make such a comparison, unless the calling page provides such details.
AnthonyWJones
@AnthonyWJones: Naturally. As you can see, that was added to the question after I wrote the answer.
Guffa
yeah the clarification was in response to the answer
A: 

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).

AnthonyWJones