asp variable for the filename of the asp file

Posted on 2012-09-16
Last Modified: 2012-09-17
I would like to know which asp variable I would use to get the name of the current asp file.

Question by:HalCHub
    LVL 30

    Assisted Solution

    by:Wayne Barron
    Is this what you are referring too?

    LVL 82

    Accepted Solution

    This short program will show you the values of all the available server variables.  Request.ServerVariables("PATH_INFO") is an example at the bottom but you can use any of the names shown in BOLD when you run the file on your ASP web server.

    <%@ LANGUAGE = VBScript %>
    <%  Option Explicit		%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    <title>ASP Server Variables</title>
    <h1>ASP Server Variables</h1>
    Dim item
    For each item in Request.ServerVariables
    	Response.Write "<b>" & item & "</b>: " _
    	& Request.ServerVariables(item) _
    	& "<br>" & vbCrLf
    	Response.Write "<b>PATH_INFO</b>: " _
    	& Request.ServerVariables("PATH_INFO") _
    	& "<br>" & vbCrLf

    Open in new window

    LVL 52

    Expert Comment

    by:Scott Fell, EE MVE
    FullPageName= Request.ServerVariables("SCRIPT_NAME")
    PageParser = instrRev(FullPageName,"/")
    CurrentPage = mid(FullPageName, PageParser+1, len(FullPageName) - PageParser)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Adobe Dreamweaver CC 2015

    Adobe Dreamweaver Creative Cloud is used by web designers and front-end developers and allows you to visualize your site in real-time as you code. This course covers exam objectives for the Adobe Certified Associate (ACA) certification.

    Suggested Solutions

    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now