You can also use (VB.Net):
Dim pageName as String = Page.GetType().Name
which replaces the underlined extension
So, from Default.aspx you will be returned Default_aspx
You can also use:
Dim pageName as String = CType(HttpContext.Current.CurrentHandler, Page).GetType().Name
which will give the same results as described above.
source share