Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Problem with getting file from VPP


I have the VPP:


I have the folder with this adress: MySite\appdata\RobotsTxt, and 2 files in it:
robots.txt & sitemap.xml

If I don't mistake, when  i go to link like: http://localhost/MySite/Robots.txt, I should see a dialog offering to download my file. But I have no this.

What this may be because?

Apr 24, 2015 15:19

Sorry to ask but why would you do like that?

These files should be in the root of the site, that is the place all robots are looking for them.

Apr 24, 2015 15:31

To Henrik Fransas 

Yeah, I know. It could be any other file and robots was placed here just for test, and of course this file placed at root. But it's doesn't matter now. 

Apr 24, 2015 15:37

Hello Aliaksei, you may want to consider using EPiRobots to render your robots.txt file as this means its editable inside EPiServer:

Apr 24, 2015 15:46

To David Knipe 

I read this. But I user Episerver 8 and this module has a compatibility problems. I have no resolve for this.

Apr 24, 2015 16:32

If you are using EPiServer 8, the VPP folders are pretty much gone.

Apr 24, 2015 16:38

To Henrik Fransas

So how can i write file to server filesystem & after have posibility to load it? 

Apr 24, 2015 16:46

If you are using MVC you can use routing. It might be possible with webforms also

Read more here:

Apr 24, 2015 16:51

This link might be useful. It gives you good examples on how to write/read files

Apr 24, 2015 17:36

Why not server the robots.txt as an ordinary property on startpage via an controller? Easy to create that if you like. Just an action returning a robots.txt instead of a view. You also need to register a route for the robots.txt in a initialization module of episerver.

But it is like 10 lines of code :) In the below sample I have used a settingspage but you could have the property stored in the startpage instead.

Something like this:

 //Maps route for robots.txt
            RouteTable.Routes.MapRoute("RobotsTxtRoute", "robots.txt", new { controller = "RobotsTxt", action = "Index" });

 /// <summary>
    ///     Controller for serving robots.txt and content from startpage property.
    /// </summary>
    public class RobotsTxtController : Controller
        private Injected<IContentLoader> ContentLoader { get; set; }

        public ActionResult Index()
            var page = ContentLoader.Service.Get<StartPage>(ContentReference.StartPage);

            var settingsPage = ContentLoader.Service.Get<SettingsPage>(page.SettingsPage);
            string content = settingsPage.RobotsTxtContent;
            return Content(content, "text/plain");
Apr 25, 2015 22:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.