ScrewTurn.Wiki.Tools.DetectCurrentFullName C# (CSharp) Method

DetectCurrentFullName() public static method

Detects the full name of the current page using the Page and NS parameters in the query string.
public static DetectCurrentFullName ( ) : string
return string
        public static string DetectCurrentFullName()
        {
            string nspace = HttpContext.Current.Request["NS"] != null ? HttpContext.Current.Request["NS"] : "";
            string page = HttpContext.Current.Request["Page"] != null ? HttpContext.Current.Request["Page"] : "";

            string fullName = null;
            if(!page.StartsWith(nspace + ".")) fullName = nspace + "." + page;
            else fullName = page;

            return fullName.Trim('.');
        }

Usage Example

示例#1
0
 /// <summary>
 /// Detects the full name of the current page using the <b>Page</b> and <b>NS</b> parameters in the query string.
 /// </summary>
 /// <returns>The full name of the page, regardless of the existence of the page.</returns>
 protected string DetectFullName()
 {
     return(Tools.DetectCurrentFullName());
 }