Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

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?
0
rafaelrgl
Asked:
rafaelrgl
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
With Javascript use : var thePath = location.pathname.substr(1);
0
 
rafaelrglAuthor Commented:
and with asp.net using vb
0
 
disruptCommented:

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
 
rafaelrglAuthor Commented:
thanks a lots :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now