Getting Name Of Page

Results 1 to 2 of 2

Thread: Getting Name Of Page

  1. #1
    Join Date
    Dec 1969

    Default Getting Name Of Page

    How can I get the name of a page, I know I need to somehow parse SCRIPT_NAME or URL Variable to extract the whatever.asp, but I can&#039;t figure it out. <BR><BR>Thanks,<BR>Scott<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Getting Name Of Page

    &#060;%<BR>words = Split( Request.ServerVariables("URL"), "/" )<BR>pageName = words( UBound( words ) )<BR>%&#062;<BR><BR>We split the full URL into separate pieces at each / mark.<BR><BR>Then we simply take the last one found in the array of pieces.<BR><BR>Another way:<BR><BR>&#060;%<BR>temp = Request.ServerVariables("URL")<BR>pageName = Mid( temp, InStrRev( temp, "/" ) + 1 )<BR>%&#062;<BR><BR>That gets the URL, searches *backwards* for the first / in from the right, and then chops off just the part past that / character.<BR><BR>Check both to make sure they work if there isn&#039;t any / in the URL, but I think they both do.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts