Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

get the page name and querystrings only

Posted on 2011-09-14
4
Medium Priority
?
325 Views
Last Modified: 2012-08-13
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
Comment
Question by:rafaelrgl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36539626
With Javascript use : var thePath = location.pathname.substr(1);
0
 
LVL 1

Author Comment

by:rafaelrgl
ID: 36539694
and with asp.net using vb
0
 
LVL 16

Accepted Solution

by:
disrupt earned 2000 total points
ID: 36539742

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
 
LVL 1

Author Closing Comment

by:rafaelrgl
ID: 36539768
thanks a lots :)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article discusses how to implement server side field validation and display customized error messages to the client.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question