private static bool IsLocal(HttpWorkerRequest wr) { string remoteAddress = wr.GetRemoteAddress(); switch (remoteAddress) { case "127.0.0.1": case "::1": return(true); } if (string.IsNullOrEmpty(remoteAddress)) { return(false); } return(remoteAddress == wr.GetLocalAddress()); }
// helpers private static bool IsLocal(HttpWorkerRequest wr) { String remoteAddress = wr.GetRemoteAddress(); // check if localhost if (remoteAddress == "127.0.0.1" || remoteAddress == "::1") return true; // if unknown, assume not local if (String.IsNullOrEmpty(remoteAddress)) return false; // compare with local address if (remoteAddress == wr.GetLocalAddress()) return true; return false; }
// helpers private static bool IsLocal(HttpWorkerRequest wr) { String remoteAddress = wr.GetRemoteAddress(); // check if localhost if (remoteAddress == "127.0.0.1" || remoteAddress == "::1") { return(true); } // if unknown, assume not local if (String.IsNullOrEmpty(remoteAddress)) { return(false); } // compare with local address if (remoteAddress == wr.GetLocalAddress()) { return(true); } return(false); }
private static bool IsLocal(HttpWorkerRequest wr) { string remoteAddress = wr.GetRemoteAddress(); switch (remoteAddress) { case "127.0.0.1": case "::1": return true; } if (string.IsNullOrEmpty(remoteAddress)) { return false; } return (remoteAddress == wr.GetLocalAddress()); }