Nov 3 2009

Get the current page name (ASP.NET)

I found this snippet of code online and thought I would share.

If you ever need the name of the page you’re currently on, this will do the trick:

Public Function GetCurrentPageName() As String
 Dim strPath As String = System.Web.HttpContext.Current.Request.Url.AbsolutePath
 Dim oInfo As new System.IO.FileInfo(strPath)
 Return oInfo.Name
End Function

.: Adam