Public senderbase dns lookup is closed, here is how to look it up in c# using HttpClient and HtmlAgilityPack

I have created an API for all sorts of email and ip related info, read more here Api for talos reputation (previous, senderscore, reputation authority and blacklists.

So the answer from SenderBase is that public access to their DNS lookup ( is closed. That’s a shame it was really handy to have a running service looking that up a few times a day.

So for now i’m using this code to look it up via HttpClient, it’s not as sufficient as DNS but it does the trick. If you are going to use this i do not recommend running it to often. According to the TOS you may not:

  • Exceed 1000 queries per day per IP or subnet
  • use any measure to circumvent this personal and non-commercial use limitation or other requirements in these Terms; or
  • modify, copy, distribute, transmit, display, perform, reproduce, publish, license, create derivative works from, transfer or sell the Materials or any information, software, products or features obtained from SenderBase.

And then it basically says “do not do bad stuff”.

I’m using ASP.NET Core and a fork of HtmlAgilityPack (because the official one does not have support for core yet)

I’m going to do this quick and dirty from the command line you can follow along using commandline, VS or your favorite tool.

Create a new console application

Add the following package in *.csproj

Restore packages

Replace program.cs with this

First we need to add the cookie telling SenderBase that we accept the TOS (you know tha one a told you about in the beginning) then we use the HttpClient to connect and read the result as a string.  Last but not least we use HtmlAgilityPack to parse the document and find the reputation result we are looking for.

Build to see that everything works and then run it. The first argument is going to be the IP you wan’t to test.

That’s it, not as fast, easy and elegant as the DNS lookup but this will do for now. Will keep working on the dns lookup again soon.


c# Entity Framework 6 set transaction isolation level

I needed to set the transaction isolation level when using Entity Framework 6.x to use SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

Found this easy way to do it, not sure if it fits your need but it’s one way.

Just use Database.ExecuteSqlCommand in DataContext constructor.