A
ad
When I a webpage, say "MyPage.aspx", How to get the page name of itsef
(MyPage.aspx)?
(MyPage.aspx)?
Mark Fitzpatrick said:You can find the name through the ServerVariables Collection. Use the C# example below
to get the current page name.
Request.ServerVariables["SCRIPT_NAME"].ToString()
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
ad said:When I a webpage, say "MyPage.aspx", How to get the page name of itsef
(MyPage.aspx)?
Mark Fitzpatrick said:You can find the name through the ServerVariables Collection. Use the C#
example below to get the current page name.
Request.ServerVariables["SCRIPT_NAME"].ToString()
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
ad said:When I a webpage, say "MyPage.aspx", How to get the page name of itsef
(MyPage.aspx)?
ad said:Thank!
But the "Request.ServerVariables["SCRIPT_NAME"].ToString()" will get the
whole path like:
/AppPath/SubPath/MyPage.aspx. But I only want the page name.
How can I do that?
Mark Fitzpatrick said:You can find the name through the ServerVariables Collection. Use the C#
example below to get the current page name.
Request.ServerVariables["SCRIPT_NAME"].ToString()
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
ad said:When I a webpage, say "MyPage.aspx", How to get the page name of itsef
(MyPage.aspx)?
Jouni Karppinen said:You can get it by only one row of code by using System.IO.Path:
C#
string pagename =
System.IO.Path.GetFileName(Request.ServerVariables["SCRIPT_NAME"])
ad said:When I a webpage, say "MyPage.aspx", How to get the page name of itsef
(MyPage.aspx)?
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.