SaaS CMS has officially launched! Learn more now.

Rendering Episerver.Url with mailto, results in garbage characters


Pretty straightforward, I ripped off the Alloy MVC demo and either one of these

@Html.UrlLink(new EPiServer.Url(""))
<a href="@Url.ContentUrl(new EPiServer.Url(""))">Send email</a>

Renders an anchor tag with href="mailto::25//". If I try anything other than mailto, for instance

@Html.UrlLink(new EPiServer.Url(""))

Then it renders correctly. Sadly my browser does not understand what "mailltoo" means. Email adresses in EPiServer.SpecializedProperties.LinkItems work fine, but all I have is this Url. How do I wrangle a clean href string out of it, regardless of what the target might be?

Mar 14, 2014 11:23

Hi Kjell

Same issue happened to me, do you have any solution for this issue?

Jul 26, 2014 4:51

If your email address is a string property in your model, you can just use:

@Html.PropertyFor(m => m.CurrentPage.Email)

Jul 28, 2014 13:30


I have the following definition:

            GroupName = SystemTabNames.Content,
            Order = 30)]
        public virtual Url Info { get; set; }

And the following rendering:


@Model.CurrentBlock.Info =, ie.

The version of EPi is

Jul 28, 2014 13:47

Hi Mari

If I set this property as string and user wants to set this as internal page link later, it's not that user fridenly to the end user.

Jul 28, 2014 15:00

Hi Marija

If I render the href without using @Url.ContentUrl helper method, it's all working fine even without having BackingType attribute. Howerver if the property value is changed to internal link, the href value is not displaying as a friendly url instead it displays the episerver internal link e.g. /link/xxxxxxx.

I am not too sure if the episerver internal link will affect the SEO, that's why I prefer to use Url.ContentUrl helper to generate the EPiServer.Url link no matter what type of the url it is. 

Jul 28, 2014 15:15

Hello Guys,

I am experiencing the same issue, did you manage to circumvent this issue without creating a new block?


Nov 28, 2014 20:13

Late reply, but still relevant. I was faced with the same problem. My solution was to get the url differently if it was a mailto.

var href = Model.MyUrl.Scheme == "mailto" ? Model.MyUrl.ToString() : Url.ContentUrl(Model.MyUrl);

You can create an extension method that returns the processed Url

public static string Url(this HtmlHelper helper, Url url)
    if (url == null)
        return null;

    return url.Scheme == "mailto" ? url.ToString() : UrlExtensions.ContentUrl(null, url);

Or you can create an extension method that returns an anchor with the correct url, it's up to you :)

All the best,

Dec 18, 2014 14:35

I know this is an old post...but, I'm having the same issue. Has anyone reported this as a bug? Is EPiServer planing on fixing it?

Sep 15, 2015 16:54

For you who reads this.
If you change to use Url.ContentUrl instead it works with both email address and internal links

Jan 10, 2017 15:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.