From 69dc012dc728c918add781fa409bd9a25c2b4e04 Mon Sep 17 00:00:00 2001 From: Tommy Date: Mon, 16 Feb 2015 14:55:43 -0500 Subject: [PATCH] nany serve robots.txt file --- src/AboutMe.Web/AppStart/Bootstrap.cs | 1 + src/AboutMe.Web/{ => Content}/robots.txt | 0 src/AboutMe.Web/Modules/Index.cs | 13 ------------- 3 files changed, 1 insertion(+), 13 deletions(-) rename src/AboutMe.Web/{ => Content}/robots.txt (100%) diff --git a/src/AboutMe.Web/AppStart/Bootstrap.cs b/src/AboutMe.Web/AppStart/Bootstrap.cs index e7c2e0e..d609f66 100644 --- a/src/AboutMe.Web/AppStart/Bootstrap.cs +++ b/src/AboutMe.Web/AppStart/Bootstrap.cs @@ -12,6 +12,7 @@ namespace AboutMe.Web.AppStart conventions.StaticContentsConventions.AddDirectory("Images"); conventions.StaticContentsConventions.AddDirectory("Scripts"); conventions.StaticContentsConventions.AddDirectory("fonts"); + conventions.StaticContentsConventions.AddFile("/robots.txt",System.IO.Path.Combine("Content", "robots.txt")); } } } \ No newline at end of file diff --git a/src/AboutMe.Web/robots.txt b/src/AboutMe.Web/Content/robots.txt similarity index 100% rename from src/AboutMe.Web/robots.txt rename to src/AboutMe.Web/Content/robots.txt diff --git a/src/AboutMe.Web/Modules/Index.cs b/src/AboutMe.Web/Modules/Index.cs index 20eb0d3..d985a71 100644 --- a/src/AboutMe.Web/Modules/Index.cs +++ b/src/AboutMe.Web/Modules/Index.cs @@ -11,19 +11,6 @@ namespace AboutMe.Web.Modules public Index() { Get["/"] = x => View["Index"]; - Get["robots.txt"] = x => - { - var res = this.Response.AsFile("robots.txt", "text/plain"); - res.Contents = a => - { - var msg = new StreamWriter(a); - msg.Write(new StringBuilder().AppendLine("User-agent: *")); - msg.Flush(); - msg.Dispose(); - }; - - return res; - }; } } } \ No newline at end of file