Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 105969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:31:22+00:00 2026-05-11T01:31:22+00:00

I was just reviewing some old code and found the following (inside foo.asp): Const

  • 0

I was just reviewing some old code and found the following (inside foo.asp):

Const ASP_FILENAME = 'foo.asp'  ' TODO: Update this to the name of this file (if changed) 

The variable is only used for logging errors. (ie. ‘Error in foo.asp – Could not create xxxxx object.’) Is there any way to avoid this?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:31:23+00:00Added an answer on May 11, 2026 at 1:31 am

    From the now-defunct Aspfaq.com (thanks to Archive.org):

    How do I get the name of the current URL / page?

    This one is pretty easy, but there are two parts.

    To retrieve the name of the current file, you can use any of these:

    <%      Response.Write Request.ServerVariables('SCRIPT_NAME') & '<br>'      Response.Write Request.ServerVariables('PATH_INFO') & '<br>'      Response.Write Request.ServerVariables('URL') & '<br>'  %> 

    To make that path local (for example, to use with FileSystemObject), just apply the server.mappath() method to the result.

    To get the entire URL, including the http:// or https:// prefix, you can do this:

    <%      prot = 'http'      https = lcase(request.ServerVariables('HTTPS'))      if https <> 'off' then prot = 'https'      domainname = Request.ServerVariables('SERVER_NAME')      filename = Request.ServerVariables('SCRIPT_NAME')      querystring = Request.ServerVariables('QUERY_STRING')      response.write prot & '://' & domainname & filename & '?' & querystring  %> 

    To get the page name ONLY, use something like this:

    <%      scr = Request.ServerVariables('SCRIPT_NAME') & '<br>'      if instr(scr,'/')>0 then          scr = right(scr, len(scr) - instrRev(scr,'/'))      end if      response.write scr  %> 

    Or, without the IF logic:

    <%      scr = Request.ServerVariables('SCRIPT_NAME') & '<br>'      loc = instrRev(scr,'/')      scr = mid(scr, loc+1, len(scr) - loc)      response.write scr  %> 

    Now. If your file is an #INCLUDE within another file, the above scripts will produce the name of the CALLING file (since the included file is first integrated into the calling script, then the ASP within it is all executed in the context of the ‘parent’ file). One way you can work around this is to re-populate a current_filename variable before loading each include file, for example:

    <%        current_filename = 'filetoinclude.asp'   %>   <!--#include file='filetoinclude.asp'--> 

    (And no, don’t try passing current_filename as a variable to the #INCLUDE directive; see Article #2042.)

    Then, in filetoinclude.asp:

    <%      Response.Write 'Current file: ' & current_filename  %> 

    Of course, you could just as easily hard-code the filename inside of each include file. But I suppose that solution would somewhat defeat the purpose of retrieving that information at least somewhat dynamically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was reviewing some of my old code and came across this syntax: extractDir=${downloadFileName%.*}-tmp
I'm just reviewing some of my old code (have some spare time), and I
I was just reviewing one of my client's applications which uses some old outdated
After some help and reviewing of the code I got this working without any
I'm reviewing some legacy code and I've found a bug that causes the response
I'm sifting through some of my old bugs and while reviewing some nasty code
I am just reviewing some code I wrote to communicate with the serial port
I was just putting some thought into different languages (as I'm reviewing for final
I'm code reviewing a change one of my co-workers just did, and he added
I was recently reviewing some code written by two different contractors, both were basic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.