I'm struggling with the ability to take a file from the server and allow a user to download it. On my machine, I was just opening it but since it has gone to production this doesn't seem to be a working solution.
public HttpResponseMessage Post([FromBody]string[] info)
{
HttpResponseMessage resp = new HttpResponseMessage();
string html = info[0];
_file += info[2] + @"\media\";
try
{
using (StreamWriter sw = File.CreateText(_file))
{
for (int n = 0; n <= str.Length; n = n + 2)
{.WriteLine(str[n]);
}
}
do
{
string notepadPath = Environment.SystemDirectory + "\\notepad.exe";
var startInfo = new ProcessStartInfo(notepadPath)
{
WindowStyle = ProcessWindowStyle.Maximized,
Arguments = _file
};
Process.Start(startInfo);
break;
} while (true);
}
catch (Exception ex)
{
//handled
}
return resp;
}
I have attempted to implement something like this but I was unable to configure it to even build. If that really is the best route to go, can someone explain it in detail and how to go about doing it?