Getting Current URL In ASP.NET 2.0

  • Thread starter Thread starter Chip Pearson
  • Start date Start date
C

Chip Pearson

This is probably an extremely simple question. How do I get a page's own
URL? In the footer section of my Master page, I want a Label control that
will be updated with the page's own URL. Something like:

Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
Me.Label1.Text = "This Page: " & "get current URL?"
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)
 
Hello Chip,

Me.Label1.Text = "This Page: " & Request.Url.ToString()


---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

CP> This is probably an extremely simple question. How do I get a page's
CP> own URL? In the footer section of my Master page, I want a Label
CP> control that will be updated with the page's own URL. Something
CP> like:
CP>
CP> Protected Sub Page_Load(ByVal sender As Object, _
CP> ByVal e As System.EventArgs) Handles Me.Load
CP> Me.Label1.Text = "This Page: " & "get current URL?"
CP> End Sub
 
Me.Label1.Text = "This Page: " & Request.Url.ToString()

Perfect. That is exactly what I was looking for. Thank you very much.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)
 
Back
Top