I am using C# HttpListener Class to produce a local web server. But by default, HttpListener Class will read the path which my code is defaulting to.

If I want to set a different path as server root path, just like Apache can choose a root path, how to do it with HttpListener?

I have read the HttpListener document, but there is no method for doing this. So I think here is the only answer, change the current directory:

Directory.SetCurrentDirectory(rootDirectory);