Cannot find a part of the path Error

  • Thread starter Thread starter Arthur
  • Start date Start date
A

Arthur

Hi All,
I know there have been previous posts with this topic but the issue for
most seems to be the security permissions on the shared drive. My
scenario is as follows :
I have IIS on local machine, I have code on a mapped drive in the
network.
I tried writing to a folder on the mapped drive and then also to a
folder in my C:, both give the same error "Cannot fnd a part of the
path". I gave the local folder FULL CONTROL to the user EVERYONE, still
doesnt make a difference.
My code is as follows :
try
{
FileStream File = new
FileStream(ConfigurationSettings.AppSettings["file_location"] +
System.DateTime.Now.Ticks.ToString() + ".xml", FileMode.Append,
FileAccess.Write);
System.Web.HttpContext.Current.Response.Write("Created the File
Stream");
StreamWriter sw = new StreamWriter(File);
sw.WriteLine(a.OuterXml);
sw.Close();
}
catch(Exception e)
{
Response.Write(e.Message);
Response.End();
}


Any help is greatly appreciated.
Thanks in advance,
Ben
 
For any one interested, I resolved this issue:
1. Changed the "\" to "\\" in the web config entry for the folder path.
2. Most important, changed the folder to map to the drive where code
was running from(on the server) instead of on my local machine.

Just wanted to post my solution in this forum for anyone who has a
similar issue .
 
Back
Top