UrlHelperExtensionsIdenticon Method (UrlHelper, Object, Int32, ExportImageFormat, IdenticonStyle)

Generates an URL to an identicon.
public static string Identicon(
	this UrlHelper helper,
	Object value,
	int size,
	ExportImageFormat format = ExportImageFormat.Png,
	IdenticonStyle style = null


The UrlHelper.
The value that will be hashed and used as base for the icon.
The size of the generated icon in pixels.
formatJdenticonExportImageFormat (Optional)
The file format of the generated icon.
styleJdenticonIdenticonStyle (Optional)
The icon style.

Return Value


Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type UrlHelper. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).


ArgumentOutOfRangeExceptionsize was less than 1.
ArgumentNullExceptionhelper was null.


This extension method can be used in your cshtml files to generate urls to identicons. Requests to the generated url will be handled by the IdenticonHttpHandler handler, which is automatically installed in your Web.config when installing the Jdenticon.AspNet.Mvc NuGet package.


This example shows how to use the UrlHelper extension methods to generate identicon urls.

HtmlHelper approach
@using Jdenticon.AspNet.Mvc;

<!-- The following markup -->

<div class="user-info">
    <img src="@Url.Identicon("JohnDoe64", 60)" width="60" height="60" alt="JohnDoe64 icon" >
    <div class="user-info__name">JohnDoe64</div>

<!-- is rendered as -->

<div class="user-info">
    <img src="/identicon.axd?5AMA8Xyneag78XyneQ--" width="60" height="60" alt="JohnDoe64 icon" />
    <div class="user-info__name">JohnDoe64</div>

See Also