Ejemplo n.º 1
0
        //public static string BaseUrl()
        //{
        //    return Cache.GetItem<string>(CacheArea.Global, "BaseURL", ()=> {
        //        if (HttpContext.Current != null)
        //        {

        //            var request = HttpContext.Current.Request;
        //            var appUrl = HttpRuntime.AppDomainAppVirtualPath;

        //            if (!String.IsNullOrWhiteSpace(appUrl) && (appUrl.Last() != '/')) appUrl += "/";
        //            return String.Format("{0}://{1}{2}", request.Url.Scheme, request.Url.Authority, appUrl);
        //        }
        //        return null;
        //    });
        //}



        public bool Exists(string directory, string fileName)
        {
            if (!(directory.EndsWith("/") || directory.EndsWith("\\")))
            {
                directory = directory + "/";
            }
            var fi = new FileInfo(_serverService.MapPath(directory + fileName));

            if (!fi.Directory.Exists)
            {
                fi.Directory.Create();
            }
            return(fi.Exists);
        }