user4210292
user4210292

Reputation:

Display Current Directory - Classic ASP

Is there a way to display the current directory you're in on the page using classic asp? I used to do it using PHP but I've had a browse around various forums and not found a working way to do it in classic ASP.

My folder structure is as follows:

Applications
  MainMenu
    default.asp
    pages
      page1.inc
      page2.inc
  Orders
    default.asp
    pages
      page1.inc
      page2.inc
  Application
    default.asp
    pages
      page1.inc
      page2.inc

When I'm in any of the different sections I'd like to display the directory name in the page header.

Upvotes: 2

Views: 6367

Answers (1)

Stephen Bodine
Stephen Bodine

Reputation: 519

Had to go old school on this one.

A = Request.ServerVariables("PATH_INFO")
B = split(A,"/")
response.write (B(ubound(B)-1))

A loads server variable of the full path including the file name. B spits this by the "/" And finally the last directory name is shown with the (B(ubound(B)-1)) where ubound finds the count of array elements and then selects the next to last result.

Upvotes: 3

Related Questions