Solved

get the page name and querystrings only

Posted on 2011-09-14
4
322 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 500 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

729 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