Search code examples
asp.netvbscriptserver-side-includes

From an included file, how do I tell which file included it?


I've got a file called header.asp that is included in almost all the pages of my site using a SSI:

<!-- #include file="header.asp" -->

In header.asp I want to output some html depending on which file included it. Assume that the file being request is the file that includes header.asp. In PHP, I can check the $_SERVER['REQUEST_URI'] to get the file that was requested. How can I get this information in ASP?


Solution

  • To get the page, you can use:

    Request.ServerVariables("REQUEST_URI")
    

    I'm not sure how to get the immediate page the included the "header.asp" file, especially in the case of nested includes, or if you are even asking that.