获取文件asp.net的相对路径

Jua*_*mez 2 c# asp.net

我有一个MVC4应用程序,一个控制器方法需要一些文件(这个文件有一些Json对象),读取proccessit然后deleteit.

这些文件使用ftp上传到我的网站.我的项目结构就是这样的

wwwroot
  bin
  content
  images
  scripts 
  suscribers // This is my ftp folder 
    _suscriber1
      _proccess1
        file1.txt //This is a Json file 
        file2.txt 
        ...
      _proccess2
      ...
    _suscriber2 
    ...
Run Code Online (Sandbox Code Playgroud)

我的所有文件(file1.txt ...)都已加载好了.在我的控制器上,我试图以这种方式读取file1.txt:

string suscriberDir= string.Format("_{0}", suscriber.Id);
string[] laPath = {System.AppDomain.CurrentDomain.BaseDirectory, "suscribers", suscriberDir};
string lcPath = Path.Combine(laPath);
string[] laPath2 = { lcPath, "_proccess1" , "_File1.txt" };
lcPath = Path.Combine(laPath2);
StreamReader reader = new StreamReader(lcPath);
string personas = reader.ReadToEnd();
reader.Close();
Run Code Online (Sandbox Code Playgroud)

我的问题是它给我一个filenotfound异常.

读取file1.txt并获取其内容的正确方法是什么?

Ret*_*ser 7

尝试使用 Server.MapPath("_File1.txt");