示例#1
0
        public IWebCommandResult Execute(IWebContext context, WebRequestRouteMatch routeMatch)
        {
            UrlHelper     url = new UrlHelper(context.ApplicationUrl);
            StringBuilder s   = new StringBuilder();

            s.AppendLine(@"User-agent: *");

            foreach (string disallow in disallows)
            {
                s.AppendLine(@"Disallow: {0}".Fmt(url.Base() + disallow));
            }

            if (sitemapRelativeUrl != null)
            {
                s.AppendLine(@"Sitemap: {0}".Fmt(url.AbsoluteBase() + sitemapRelativeUrl));
            }

            TextResult result = new TextResult(s.ToString());

            result.AddHeader(HttpConsts.HeaderContentType, HttpConsts.ContentTypeTextPlainUtf8);
            result.LoggingSeverity = LoggingSeverity.Verbose;
            return(result);
        }