Google

Thursday, May 1, 2008

C# Get Current Page File Name

In web development using C#, getting the current page name
e.g --> home.aspx
is very easy...

Try this..

Using System.IO

String _pathName = Path.GetFileName(request.PhysicalPath);
Response.Write(_pathName);

1 comment:

Unknown said...

I recommend capitalizing the 'R' on request -
String _pathName = Path.GetFileName(Request.PhysicalPath);
Response.Write(_pathName);