how to get the page name?

  • Thread starter Thread starter ma
  • Start date Start date
M

ma

Hello,

I want to get the name of current page. How can I do this?



For example if I am running the code from a page called deafult.aspx, it
should return me default.aspx and if I am running from a page called
mypage.aspx, it should return mypage.aspx. page.tostring() doesn't return
this value. Any suggestion?



Regards
 
Even simpler than that :

VB.NET :
Dim pagename as string = System.IO.Path.GetFileName(Request.ServerVariables("SCRIPT_NAME"))

C# :
string pagename = System.IO.Path.GetFileName(Request.ServerVariables["SCRIPT_NAME"]);



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top