Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

How do I get the file name?



2:56 am on Feb 9, 2004 (gmt 0)

10+ Year Member

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
do something

but CurrentPage.aspx needs to be retrieved from the Q-string somehow.



4:13 pm on Feb 9, 2004 (gmt 0)

10+ Year Member

Try this:

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)

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member

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)

WebmasterWorld Senior Member 10+ Year Member

You might want to check this thread, [webmasterworld.com ], that shows all the different options for Request.ServerVariables.

Featured Threads

Hot Threads This Week

Hot Threads This Month