| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Accredited PayPal World Seller|
|How do I get the file name?|
| 2:56 am on Feb 9, 2004 (gmt 0)|
It's probably the simplist thing, and I'm having so much trouble doing it.
I'm trying to compare a name of a page from a Database, to that of the current page.
But I don't know how to retrieve the name of the current page.
IF DBPageName.aspx = CurrentPageName.aspx THEN
but CurrentPage.aspx needs to be retrieved from the Q-string somehow.
| 4:13 pm on Feb 9, 2004 (gmt 0)|
Dim strPath As String = Request.ServerVariables("PATH_INFO")
strPath = strPath.Substring(strPath.LastIndexOf("/") + 1)
It calls the "PATH_INFO" server variable and separates only the page name out based on the last instance of "/".
Hope this helps,
| 4:14 pm on Feb 9, 2004 (gmt 0)|
There's also the SCRIPT_NAME server variable which returns the file name part of the URL.
| 5:48 am on Feb 18, 2004 (gmt 0)|
I was looking for exactly the same thing! Thank-you VERY much for pointing that out! I have been looking for like at least 5 hours for that small piece of code!
.::// Ninkasi \\::.
| 8:58 pm on Feb 18, 2004 (gmt 0)|
You might want to check this thread, [webmasterworld.com ], that shows all the different options for Request.ServerVariables.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
© Webmaster World 1996-2014 all rights reserved