using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; namespace AipGateway.Log { /// /// Token-based authentication for ASP .NET MVC REST web services. /// Copyright (c) 2015 Kory Becker /// http://primaryobjects.com/kory-becker /// License MIT /// public static class CommonManager { public static string GetIP(HttpRequestBase request) { string ip = request.Headers["X-Forwarded-For"]; // AWS compatibility if (string.IsNullOrEmpty(ip)) { ip = request.UserHostAddress; } return ip; } } }