Vulnerability in EPiServer.Forms
question. (see image). I have 2 sites in my CMS (NL and EN). Both have a starting homepage etc.
Now i have a switch on the site to switch to the other homepage.
The problem is, from my view i have the contentreference of my (other)homepage then the one i'm on, but when i try @Url.ContentUrl(otherHomepage.ContentLink) i get the first binding of the site. Which can be something different.
What i want is the SiteURL which i added in the image below. I found a @UriSupport.SiteUrl, but that only gives me the URL of the CurrentSite. I want the URL as in the image from the othersite, then the one i'm one.
Give the contentReference (of the homepage),how can i retrieve the mainURL?
P.S Using latest EPiServer 8
[Pasting files is not allowed]
Maybe you could explicit pass language branch:
var url = ServiceLocator.Current.GetInstance<UrlResolver>().GetUrl(ContentReference.StartPage, "nl");
i found the problem... my code was correct, but in my bindings for the site, you can set a primary one. I didnt set that so it randomly (or first) picked one.
Now i added a primary binding and now @Url.ContentUrl(otherHomepage.ContentLink) picks the correct url..
Good to know. I think I made another uglier work around earlier for the same problem :)