Just a simple tip when you try to use HtmlDecode in MVC (Razor) - don't use WebUtility.HtmlDecode, it won't work.
Just use Html.Raw instead:
It really helps to know your Html Helpers.
Html.Raw was introduced in MVC 3.
This is just a friendly reminder - when using EPiServer VPP, don't forget to specify maxVersions for each virtual path in episerver.config. By default, maxVersions is set to 5 for Documents, but nothing else.
One often forgotten feature of EPiServer VPP's is the actual versioning of files. It might be handy at times, but it's also handy remembering its drawbacks.
There might be a scenario where you have a scheduled job creating a large page structure and saving a lot of files for every page. Now imagine this job runs a couple of times every day - after a while you'll eventually run out of disk space.
(Of course you can probably write a file comparer to make sure the same file isn't uploaded multiple times.)
Make sure to specify maxVersions for Global Files, Documents and Page Files to be in complete control. More often than not, 2-3 versions are enough, rather than an infinite amount of versions ;-)
Recently we migrated an EPiServer 5 website to CMS 6 R2. Most things went well, except Page Files stopped working - we couldn't browse to any document in page files despite the VPP being there. After some research, the conclusion was that the
<location> element for page files was missing in Web.Config.
Just search for <location path="Documents"> or <location path="Global"> in Web.Config and add this section for Page Files before:
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
<add path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" validate="true" />
<staticFile expirationTime="-1.0:0:0" />
<add name="webresources" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
<add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" />
Unfortunately there still are times when you need to embed an iframe. Most of the time you would want to assign an automatic height to the iframe. It's not very easy, but it's definitely doable if you meet a couple of requirements.
Requirements needed for auto iframe height
The page calling the iframe and the iframed page should have the:
- Same host
- Same protocol
- Same port
- a page at www.domain1.com can't call a page on www.domain2.com
- a page at domain1.com can call a page on domain1.com or on a sub domain, xx.domain1.com
For this to work, you also need to add this code snippet (in
<script>) to both pages, preferably in the
document.domain = /(\w+)(.\w+)?$/.exec(location.hostname);
This code snippet tells the browser the default domain (host), which need to be the same according to the requirements above.
Common error code
This is the error you get in Chrome if you make an illegal iframe call:
from frame with URL http://otherdomain.com.
Domains, protocols and ports must match.
Now you know the solution.
Auto iframe script
Here's a working auto iframe height script you can use.
It's even non jQuery (even though it says it's jQuery).