Exemplo n.º 1
0
        /// <summary>重启网站</summary>
        public static void RebootSite()
        {
            var path = Asp.MapPath("~/web.config");

            using (var writer = new StreamWriter(path, true))
            {
                writer.WriteLine();
                writer.Close();
            }
        }
Exemplo n.º 2
0
        //-------------------------------------------
        // Url & Path
        //-------------------------------------------
        /// <summary>是否是本网站文件(如果以.~/开头或host相同是本站文件)</summary>
        public static bool IsSiteFile(this string url)
        {
            if (url.IsEmpty())
            {
                return(false);
            }
            if (url.StartsWith("/") || url.StartsWith("~/") || url.StartsWith("."))
            {
                return(true);
            }
            url = Asp.ResolveUrl(url);
            Uri uri = new Uri(url);

            return(uri.Host.ToLower() == Asp.Request.Url.Host.ToLower());
        }
Exemplo n.º 3
0
 /// <summary>将物理路径转化为虚拟路径</summary>
 public static string ToVirtualPath(this string physicalPath)
 {
     return(physicalPath.ToRelativePath(Asp.MapPath("/")).Replace("\\", "/"));
 }