ASP.NET Core

To use Jdenticon on a ASP.NET Core site, start by installing the Jdenticon.AspNetCore NuGet package.

PM> Install-Package Jdenticon.AspNetCore

Then enable Jdenticon in your application by calling UseJdenticon in Startup.cs. Put the call right above UseStaticFiles.

using Jdenticon.AspNetCore;
/* ... */

public class Startup
{
    /* ... */

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        /* ... */
        app.UseJdenticon();
        app.UseStaticFiles();
        app.UseMvc();
        /* ... */
    }
}

Make the tag helper and the extensions for @Html and @Url available to your views by adding the following lines to _ViewImports.cshtml.

@using Jdenticon.AspNetCore
@addTagHelper "*, Jdenticon.AspNetCore"

Now you can render icons on any page by using any of the following examples:

@{
    var myIconValue = "jdenticon";
}

<!-- Tag helper approach -->
<img identicon-value="myIconValue" width="100" height="100" alt="Identicon" />

<!-- @@Html approach -->
@Html.Identicon(myIconValue, size: 100, alt: "Icon")

<!-- @@Url approach -->
<img src="@Url.Identicon(myIconValue, size: 100)" alt="Icon" width="100" height="100" />

See also

Full documentation