Lightweight C# ASP.NET MVC and Web API IP address filtering library
The library allows validating IP address against:
- Single IP address
- List of multiple IP addresses
- Single IP address range
- Multiple IP address ranges
public class DataController : ApiController
{
[HttpGet]
[Route("api/data/{recordId}")]
[IPAddressFilter("94.201.50.212", IPAddressFilteringAction.Restrict)]
public HttpResponseMessage GetData(int recordId)
{
/* Create response logic here */
return this.Request.CreateResponse<object>(HttpStatusCode.OK, new object());
}
}