Introducing GravatarHelper.NetStandard

C#, .Net Core, Cross Platform, ASP.NET Core, .Net Standard

5.00 ( 1 votes) | 2122

In this article, we will talk about a simple .Net Standard library for Gravatar and how to use it. So let`s get started.


Before moving on to the details of GravatarHelper.NetStandard library, let`s first briefly talk about what is .Net Standard library and some resources which I found useful while learning about it.

What Is .Net Standard?

According to the Microsoft documentation .Net Standard library is

A formal specification of .NET API`s that are intended to be available on all .NET runtimes.

The main motive is to enable developers to create one library which can be used across multiple .NET runtimes, using the same set of APIs. Two main resources that help me understand more about the .Net Standard library are:


First link is the gist created by David Fowler from Microsoft. He has explained the .Net Standard library in terms of interface and what set of APIs will be included in particular version of .Net Standard. It really helped me to understand the concept of .Net Standard and meaning of “formal specification” in Microsoft documentation.

Second link is the .Net Standard video series created by Immo Landwerth from Microsoft. He has explained various concepts like what is .Net Standard library, what is coming in .Net Standard 2.0 and also explained a tool called API port which allows us to check the compatibility of current library with .Net Standard. This tool comes in two flavors: Command line version and as a Visual Studio extension.

So while I was trying to learn .Net Standard, I thought it would be nice if I actually create one .Net Standard library, which will help me to understand the concept more easily and this is where GravatarHelper.NetStandard library was born.

What Is GravatarHelper.NetStandard Library?

It`s a simple .Net standard library to easily get profile picture URL, QR code image URL for profile and profile information for a user using email address from Gravatar.

This library is available on NuGet:

Supported Platforms:

  • .Net Framework 3.5
  • .Net Framework 4
  • .Net Framework 4.5
  • .Net Framework 4.5.1
  • .Net Framework 4.5.2
  • .Net Framework 4.6
  • .Net Framework 4.6.1
  • .Net Framework 4.6.2
  • .Net Standard 1.3
  • Portable Class Library (.NET Framework 4.5, Windows 8.0, Windows Phone 8.0, Windows Phone App 8.1)- Profile 259

Now let`s see how to use this library.

Get Gravatar Image URL:

To get Gravatar image URL for email address "", use the following syntax.


To get image URL over https, use following syntax.


 There are different overload methods available where we can specify different parameters like image size, required extension for an image, rating, Gravatar default image type etc.

Get the QR Code Image URL:

To get the QR code image for email address "", use the following syntax.


Get The Gravatar Profile Information:

To get the Gravatar profile information for a user using email address "", use the following syntax.

// Available only for .Net Framework 4.5 and above
await Gravatar.GetGravatarProfileInformationAsync("");

// For .Net Framework 3.5 and 4.0

 Above method will return an object of type OperationResult.

public class OperationResult
        public bool Success { get; set; }

        public ProfileInformation Profile { get; set; }

        public string Error { get; set; }

 If request for profile information is successful, then Success property will be set to true and Profile object will contain the profile information.

If request for profile information failed, then Success property will be set to false, Profile object will be null and Error property will contain the error message.

Note: Profile requests will only resolve for the primary email address.

GravatarHelper.NetStandard is completely open source. You can find the repository on GitHub. So please try out the library and let me know about it in comments. 

I have also created a tag helper for ASP.NET Core using this library as a base library. It`s also available on NuGet and source code is available on GitHub.


In this article, we talked about GravatarHelper.NetStandard library and how to use it. I hope you enjoyed reading the article.

Happy Coding!

Manoj Kulkarni - ManojKulkarni

Manoj Kulkarni

I am programmer, passionate blogger and foodie. I live in Nashik. I am a .Net developer. I like to learn new technologies to keep my self-updated and share that knowledge with my blog readers, friends and colleague.

Add a new comment