i have some html files as part of a regular website that has been ported over to asp.net mvc. In my code i need to read and write these html files and stick them in a tinymce editor
To be able to read and write this file from disk in the past i had a hard coded path but this doesn't seem to work in asp.net mvc unless i do something like this:
Writing:
string _urlDirectory = @"c:\hosting\MySite\Views\Members\newsletters\test.html";
System.IO.File.WriteAllText(_urlDirectory, htmlData_);
Reading:
string url = @"c:\hosting\MySite\Views\Members\newsletters\test.html";
var req = WebRequest.Create(url);
var response = req.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream());
string htmlData_ = sr.ReadToEnd();
i am moving my site from one data center to another and the directory structure is changing. instead of just changing the hard coded path to another hard coded path i wanted to see if there was a more relative way to reference these files.