Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 896 Bytes

README.md

File metadata and controls

26 lines (22 loc) · 896 Bytes

Build status

IP-Address-Filtering

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

How to use

    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());
        }
    }