Could not find a part of the path 'C:\Program Files (x86)\IIS Express\~\TextFiles\ActiveUsers.txt'

后端 未结 4 1950
滥情空心
滥情空心 2021-02-19 10:13

I tried many ways to access a text file in my Visual Studio 2012 Solution from a folder named TextFiles

using (System.IO.StreamWriter file = new Sys         


        
4条回答
  •  忘掉有多难
    2021-02-19 10:46

    I ran into a similar issue and ended up using

    string sFileName = HttpContext.Current.Server.MapPath(@"~/dirname/readme.txt");
    

提交回复
热议问题