Url to current node? Options
SoerenS
Posted: Monday, October 13, 2008 9:39:37 PM

Rank: Fanatic

Joined: 7/25/2006
Posts: 433
Location: Silkeborg, Denmark
Simple question:

In a User Control, how do I get the complete URL to the current node?

Request.Url returns something like www.mydomain.com/default.aspx?umbPage=/test/MyControlPage.aspx

And I want www.mydomain.com/test/MyControlPage.aspx instead.

/SoerenS

Brug for råd til hvordan du driver en god webshop? / Need advice on how to run an effective webshop?
DeNY
Posted: Monday, October 13, 2008 10:13:05 PM
Rank: Enthusiast

Joined: 1/7/2008
Posts: 39
Hi,
Try this code:
string url = umbraco.library.NiceUrl(Node.GetCurrent().Id);

SoerenS
Posted: Monday, October 13, 2008 10:25:29 PM

Rank: Fanatic

Joined: 7/25/2006
Posts: 433
Location: Silkeborg, Denmark
Thanks!

Here's the final piece of code I ended up using (In VB):
Code:
Dim UrlVerify As String = "http://" & Request.Url.Host & umbraco.library.NiceUrl(umbraco.presentation.nodeFactory.Node.GetCurrent().Id)


/SoerenS

Brug for råd til hvordan du driver en god webshop? / Need advice on how to run an effective webshop?
mortenbock
Posted: Monday, October 13, 2008 11:54:48 PM

Rank: Addict

Joined: 7/19/2006
Posts: 815
Location: Århus, Denmark
Just watch out if you change Umbraco settings to enforce domain names. Then the niceUrl include domains in the string it returns...

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.