Alex
Alex

Reputation: 715

from Kentico 6 to Kentico 8

I need translate web-part code from Kentico 6 to Kentico 8.

In kentico 6 was nice function URLHelper.CurrentURL that returns requested current URL. Kentico removed (or deleted?) this function. So which appropriate method uses Kentico 8 API?

Thanks!

Upvotes: 1

Views: 602

Answers (2)

mnield
mnield

Reputation: 1869

There are a number of methods available to you depending on what you want to do. The two I commonly use are from CMS.Controls

  • GetDocumentUrl() will return the URL of the current document
  • GetNavigationUrl() will return the URL based upon any navigation setting the you have setup for the document.

The GetNavigationUrl method is pretty handy as it takes note of your navigation settings can help to reduce unnecessary 301 redirects (depending on how you have things set up)

Upvotes: 2

fixo
fixo

Reputation: 91

There were some changes in Kentico 7 as well (see here) but for Kentico 8, you can use this api changes tool. I believe it is now CMS.Helpers.RequestContext.CurrentURL

Upvotes: 9

Related Questions