Thursday, 15 May 2014

c# - Nancy: is there a Server.MapPath("~/") equivalent? -



c# - Nancy: is there a Server.MapPath("~/") equivalent? -

i can't seem find equivalent in nancy system.web.httpcontext.current.server.mappath() in nancy framework.

i want load textfile relative application service.

i see in assembly

using nancy; using system; namespace nancy.hosting.self { public class filesystemrootpathprovider : irootpathprovider, ihideobjectmembers { public filesystemrootpathprovider(); public string getrootpath(); } }

i'm not sure how use.

update: figured out need load can read/written bin/relase/ directory. assumed way in nancy self hosting environment? guess create sense.

you can take dependency on irootpathprovider , utilize phone call getrootpath() give root of application , can add together there (i recommend using path.combine)

c# path hosting nancy

No comments:

Post a Comment