I need to write a file to the App_Data folder in an Asp.Net MVC project. It works locally, but when I deployed it to Windows Azure, I got an error, for example:
Could not find a part of the path 'C: \ DWASFiles \ Sites \ codehint \ VirtualDirectory0 \ site \ wwwroot \ App_Data \ text.txt'.
I need to use a third-party library that needs read / write access to the App_Data folder.
I am using code like this:
var path = Server.MapPath("~/App_Data/text.txt"); using (var file = new StreamWriter(path)) { file.Write("test line"); file.Flush(); }
source share