Hi!
Normally, when requesting an URL in the system, you will get the URL for the current "mode" that you are in. The three modes are:
There are several reasons for this. The reason that we have a different URL (and behind the scenes also a different route and handler) is that we don't want to have images cached in the UI. This is because we want editors to be able to change and image and have that reflected directly in the UI (instead of having the image cached in the browser).
If you want to have a specific URL for a content item and specific mode, you can call the URL resolver directly and specify the mode you want to have, for instance:
var mode = ContextMode.Preview;
url = UrlResolver.Current.GetUrl(content.ContentLink, content.LanguageBranch(), new VirtualPathArguments() { ContextMode = mode });
When accessing a preview of a page via Edit mode the url of assets is given like
/EPiServer/CMS/Content/globalassets/project-detail-01.jpg,,23?epieditmode=False
When using Model.ImageUrl
I am doing a HttpWebRequest on this string for the file although as the request is done anonymously their is no permission to access it.
How can I overcome this, when accessing the page directly the URL returned is fine i.e. globalassets/project-detail-01.jpg
I'd rather not start trimming string if their is a better way
Minesh