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

后端 未结 4 2245
悲哀的现实
悲哀的现实 2021-02-19 10:07

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 11:03

    I ran into a similar issue and ended up using

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

提交回复
热议问题