Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > UrlHelper.GetAbsoluteUrl and Port View modes: 
User avatar
Member
Member
AlexQMN - 5/31/2011 7:52:44 AM
   
UrlHelper.GetAbsoluteUrl and Port
Hi,

I have a site that is configured with Main Domain xy.com:8080. When i use the function UrlHelper.GetAbsoluteUrl(relativeUrl) it returns only xy.com as domain without the port.

If i use UrlHelper.GetAbsoluteUrl(relativeUrl,CMSContext.CurrentSite.DomainName), then it returns correctly xy.com:8080.

Is there any way i can configure the site so the first version "UrlHelper.GetAbsoluteUrl(relativeUrl)" returns with port too?

Thanks,
Alex

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 5/31/2011 8:20:24 AM
   
RE:UrlHelper.GetAbsoluteUrl and Port
Hi,

Which URL is the current one when you're calling this method?
Because it uses UrlHelper.Url.Authority and it doesn't remove the port.
So if you would use it when you were on URL without port specified, then although the main domain is defined with a port, the method would return absolute url without port, matching the current url port...

Thank you in advance for info.

--Zdenek

User avatar
Member
Member
AlexQMN - 5/31/2011 9:40:42 AM
   
RE:UrlHelper.GetAbsoluteUrl and Port
Hello,

The Request.Url when calling the Method is indeed without port, so i guess it gets stripped away somewhere along the way...maybe because of port forwarding?

I have to check that on our side, thanks for the Info.

Alex

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 5/31/2011 10:00:45 AM
   
RE:UrlHelper.GetAbsoluteUrl and Port
Hi,

Thanks for info. Port forwarding may be behind that, you'll need to check it on your side.
If yes, the longer overload of the GetAbsoluteUrl method may be needed...

Regards,
Zdenek