DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Char Guest

    Page Name in ASP


    How can I get the page's name with visual script ???

  2. #2
    John Timney (MVP) Guest

    Re: Page Name in ASP

    look at the servervariables collection, it has a method that returns the
    script name

    Regards

    John Timney (MVP)


    Char <anguetax@hotmail.com> wrote in message news:38f1ee8a@news.devx.com...
    >
    > How can I get the page's name with visual script ???




  3. #3
    Zhou Hao Guest

    Re: Page Name in ASP


    "Char" <anguetax@hotmail.com> wrote:
    >
    >How can I get the page's name with visual script ???


    Hi,

    Here it is.

    <%= Request.ServerVariables("Script_Name")%>

    It will return the page name with the path. It's very easy to parse out what
    you want.


    Zhou Hao

  4. #4
    Join Date
    Apr 2007
    Posts
    1
    <%
    Dim strPage

    strPage= Request.ServerVariables("SCRIPT_NAME")
    strPage= Right(strPageName,Len(strPage) - InStrRev(strPage,"/"))
    %>

    This will grab JUST the page name, no directories.

  5. #5
    Join Date
    Mar 2009
    Posts
    1

    Correction

    Excellent script thanks RCarlson, however it had a couple of errors. Here's the correct version:

    <%
    Dim strPage
    Dim strPageName
    strPageName= Request.ServerVariables("SCRIPT_NAME")
    strPage= Right(strPageName,Len(strPageName) - InStrRev(strPageName,"/"))
    %>

  6. #6
    Join Date
    Apr 2010
    Posts
    1

    Correction to your "correction"

    Quote Originally Posted by justinmoss View Post
    Excellent script thanks RCarlson, however it had a couple of errors. Here's the correct version:

    <%
    Dim strPage
    Dim strPageName
    strPageName= Request.ServerVariables("SCRIPT_NAME")
    strPage= Right(strPageName,Len(strPageName) - InStrRev(strPageName,"/"))
    %>
    Actually, there are no errors in RCarlson's code. In fact, his is more efficient than yours since he doesn't unnecessarily create another variable.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links