BlogEngine.Core.Web.HttpModules.UrlRewrite.ExtractTitle C# (CSharp) Method

ExtractTitle() private static method

Extracts the title from the requested URL.
private static ExtractTitle ( HttpContext context, string url ) : string
context System.Web.HttpContext /// The context. ///
url string /// The url string. ///
return string
        private static string ExtractTitle(HttpContext context, string url)
        {
            url = url.ToLowerInvariant().Replace("---", "-");
            if (url.Contains(BlogConfig.FileExtension) && url.EndsWith("/")) {
                url = url.Substring(0, url.Length - 1);
                context.Response.AppendHeader("location", url);
                context.Response.StatusCode = 301;
            }

            url = url.Substring(0, url.IndexOf(BlogConfig.FileExtension, StringComparison.Ordinal));
            var index = url.LastIndexOf("/", StringComparison.Ordinal) + 1;
            var title = url.Substring(index);
            return context.Server.HtmlEncode(title);
        }