Subtext.Framework.Format.UrlFormats.IsInDirectory C# (CSharp) Method

IsInDirectory() public static method

Determines whether the current request is in the specified directory.
public static IsInDirectory ( String rootFolderName ) : bool
rootFolderName String Name of the root folder.
return bool
        public static bool IsInDirectory(String rootFolderName)
        {
            String appPath = StripSurroundingSlashes(HttpContext.Current.Request.ApplicationPath);

            String installPath = appPath;							// ex... "Subtext.Web" or ""
            if(installPath.Length > 0)
                installPath = "/" + installPath;
            String blogAppName = Config.CurrentBlog.Subfolder;

            if(blogAppName.Length > 0)
                installPath = installPath + "/" + blogAppName;		// ex... "/Subtext.Web/MyBlog" or "/MyBlog"

            installPath += "/" + StripSurroundingSlashes(rootFolderName) + "/";		// ex...  "Subtext.Web/MyBlog/Install/" or "/MyBlog/Install/" or "/Install/"

            return HttpContext.Current.Request.Path.IndexOf(installPath, StringComparison.InvariantCultureIgnoreCase) >= 0;
        }