One requirement of a project I'm working on is to export a file to a network share based on certain criteria. When I run the code in visual studio it works just fine but when I deploy it the actions that would initiate saving the file end in failure. the users see an alert with:
Could not find file '<full filename...>'.
In the web.config I set impersonate to true and the users have permission to write to the network share in question.
Here is the code to write to the file:
using (System.IO.FileStream fs = new System.IO.FileStream(fullpath, System.IO.FileMode.Create))
{
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(fs))
{
sw.WriteLine(RouteMeter.HeaderString);
foreach (RouteMeter meter in rm)
{
sw.WriteLine(meter);
}
}
}