Skip to content

Instantly share code, notes, and snippets.

View ChrisPelatari's full-sized avatar

Chris Pelatari ChrisPelatari

View GitHub Profile
@ChrisPelatari
ChrisPelatari / Firewall.cs
Created March 19, 2014 19:27
ASP.NET MVC ActionFilter to allow or deny IPv4 addresses with optional subnet mask. For use with AppHarbor or any other server solution which uses the X-Forwarded-For header.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
namespace AppHarbor.Web {
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true,
AllowMultiple = false)]