I try to avoid hard-coding page names in my ASP code as much as I can. Files get merged and renamed, and suddenly you've got a bunch of code that doesn't match up any longer. On a recent project, I inherited some code that had this construct to let users report bugs:
<a href="bug.asp?pageid=<% = strThisPage %>">Report a Bug on this Page</A>
The strThisPage variable was being declared and set at the top of every page to be the name of the ASP file without pathnames or extensions. For instance, archive_top.asp would be shown as archive_top in the URL. To get rid of this redundant code, I made use of the SCRIPT_NAME variable in the ServerVariables collection. Here's how you would do it:
Dim strPageID ' As String
strPageID = Request.ServerVariables("SCRIPT_NAME")
strPageID = Left(strPageID, Instr(strPageID, ".") - 1)
strPageID = Mid(strPageID, InstrRev(strPageID, "/") + 1)
Response.Write "<a href=""bug.asp?pageid=" & strPageID & """>Report a Bug on this Page</a>"
This code was added to a function and included in a common footer file for the site.