ASP MVC Sitemap is there an Image HTML Helper?

I have an ASP MVC Sitemap which look something like this

<mvcSiteMapNode title="Home" imageUrl="home.png" controller="Home" action="Index">
        <mvcSiteMapNode title="Search" controller="Search" imageUrl="magnifying_glass.png" action="Index">

The nodes all have an 'imageUrl' property assigned to them which I would like to access within my view. I know there is a SiteMap helper included within the library which allows me to the get the title via

@Html.MvcSiteMap().SiteMapTitle()

However, I can't see any way of obtaining the imgUrl. Before I write my own, does anybody know if this already exists? I've search around but can't find any way of doing it within the existing library.

Answers


OK, I've just written something myself. It's very simple.

public static class MvcSiteMapImageUrlHelper
    {
        public static MvcHtmlString SiteMapImageUrl(this MvcSiteMapHtmlHelper helper)
        {
            var node = helper.Provider.CurrentNode;

            if (node != null)
            {
                return new MvcHtmlString(node["ImageUrl"]);
            }

            return new MvcHtmlString(string.Empty);
        }
    }

Need Your Help

Unable to receive form data in web api c#

c# angular typescript

I am trying to send the uploaded excel file to web api using XMLHttpRequest but all I receive in web api is an object. How to receive uploaded file in web api?

How do I split a dictionary into specific number of smaller dictionaries using python?

python dictionary split divide chunking

I am trying to split up a large dictionary into n number of smaller dictionaries. Each dictionary entry contains a webaddress, and the point of splitting up the dictionary is so webscraping of these