My test site and localhost share the same database.
Under Admin / Manage Websites / Hostnames, I've added the following values:
When running the website from localhost, UriSupport.SiteUrl returns http://mydomain.com instead of http://localhost:12345
I'm trying to convert an internal URL to an absolute external URL using this code snippet:
Global.UrlRewriteProvider.ConvertToExternal(urlBuilder, null, Encoding.UTF8);
var friendlyUrl = UriSupport.AbsoluteUrlBySettings(urlBuilder.ToString());
Any help would be greatly appreciated.
Hostnames are probably not checked in that method. What you need to change is the site URL (the box above the hostnames).
I've never used UriSupport.SiteURL, but I guess that a shorthand to SiteDefinition.Current.SiteURL, http://world.episerver.com/Documentation/Class-library/?documentId=cms/7.5/A3A2683.
Thanks for your help!
I cannot modify the site URL because EPiServer database is shared between localhost and mydomain.com, and mydomain.com is more important than localhost.
I could solve this in 2 ways:
I was hoping that this can be solved by some EPiServer function which takes hostnames and HttpContext.Current into account :)