get the page name and querystrings only

hi, supose i have this page:

http://www.mywebsite.com/test.aspx?id=1

i want to get this part only: test.aspx?id=1
i know how to get the last part: Request.Url.Query but how to get just the page name test.aspx?
some help?
LVL 1
rafaelrglAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
disruptConnect With a Mentor Commented:

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

Open in new window

0
 
leakim971PluritechnicianCommented:
With Javascript use : var thePath = location.pathname.substr(1);
0
 
rafaelrglAuthor Commented:
and with asp.net using vb
0
 
rafaelrglAuthor Commented:
thanks a lots :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.