Hi Kjell
Same issue happened to me, do you have any solution for this issue?
If your email address is a string property in your model, you can just use:
@Html.PropertyFor(m => m.CurrentPage.Email)
Hey,
I have the following definition:
[Display(
GroupName = SystemTabNames.Content,
Order = 30)]
[BackingType(typeof(PropertyUrl))]
public virtual Url Info { get; set; }
And the following rendering:
@Model.CurrentBlock.Info = mailto:info@mogul.com, ie.
The version of EPi is 7.7.1.0.
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.
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.
Hello Guys,
I am experiencing the same issue, did you manage to circumvent this issue without creating a new block?
Cheers,
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,
Micke
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?
For you who reads this.
If you change to use Url.ContentUrl instead it works with both email address and internal links
Pretty straightforward, I ripped off the Alloy MVC demo and either one of these
@Html.UrlLink(new EPiServer.Url("mailto:adress@host.se"))
<a href="@Url.ContentUrl(new EPiServer.Url("mailto:adress@host.se"))">Send email</a>
Renders an anchor tag with href="mailto::25//adress@host.se:25". If I try anything other than mailto, for instance
@Html.UrlLink(new EPiServer.Url("mailltoo:adress@host.se"))
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?