This project has moved and is read-only. For the latest updates, please go here.

UseStaticFiles

Jan 3, 2014 at 2:16 PM
Hi.
In my old project with "Microsoft.Owin.StaticFiles" version="0.25.0-pre-21017-669-rel"

i use relative path with code:
  string contentPath = Path.Combine(Environment.CurrentDirectory, @"..\..");
  app.UseStaticFiles(contentPath);
in my new project with version="2.1.0-rc1" i have an exception: "The path must start with a '/' followed by one or more characters."

I tried to give the path as "/../.." but could not get the files.

how I can specify a relative path?
Jan 3, 2014 at 2:49 PM
I solve my problem with code:
        string contentPath = Path.Combine(Environment.CurrentDirectory, @"..\..");
        var baseUrl = "";
        app.UseStaticFiles(new Microsoft.Owin.StaticFiles.StaticFileOptions()
        {
            RequestPath = new PathString(baseUrl),
            FileSystem = new PhysicalFileSystem(contentPath)
        });