Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting page file name from URL

Status
Not open for further replies.

tester321

Programmer
Mar 13, 2007
150
CA
Grr.. not working, need help. Many thanks.

Code:
            string url = Request.ServerVariables["URL"];
            url = Mid(url, InStrRev(url, "/") + 1);

            Response.Write("this page is called:"+url);
 
Code:
string url = Request.ServerVariables["URL"];
url = [red]url.Remove(0, url.LastIndexOf("/") + 1)[/red];

Response.Write("this page is called:"+url);
 
found an easier way, but would it more resource intensive?

string url = System.IO.Path.GetFileName(Request.Path);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top