public static bool IsCallerInSameServer(out string ErrMsgIs) { ErrMsgIs = ""; string RemoteAddr = CWeb.GetRemoteIpAddress(HttpContext.Current); RemoteAddr = CPath.GetServerUrl(RemoteAddr).ToLower(); string Server = HttpContext.Current.Request.ServerVariables.Get("LOCAL_ADDR"); Server = CPath.GetServerUrl(Server).ToLower(); if (RemoteAddr == Server) { return(true); } Server = HttpContext.Current.Request.ServerVariables.Get("HTTP_HOST"); Server = CPath.GetServerUrl(Server).ToLower(); if (RemoteAddr == Server) { return(true); } ErrMsgIs = "서버명이 다음과 같이 일치하지 않습니다.\r\n클라이언트: " + RemoteAddr + ", 서버: " + Server; return(false); }
private Uri GetRemoteUri(string FolderName, string FileName) { string Url = this.Url; if (!string.IsNullOrEmpty(FolderName)) { Url = CPath.CombineUrl(Url, FolderName.Trim('/')); if (!Url.EndsWith("/")) { Url = Url + "/"; } } if (!string.IsNullOrEmpty(FileName)) { Url = CPath.CombineUrl(Url, FileName); } //C# 폴더가 C 폴더로 만들어지는 것을 방지 Url = CWeb.EncodeUrlForWebRequest(Url); Uri RemoteUri = new Uri(Url); return(RemoteUri); }