I need to create a file with a name of IP address:
The code is:
string dirAddress = "C:\\FTPTrace\\" + ipHeader.DestinationAddress.ToString() + ".txt";
System.IO.StreamWriter logfile = new StreamWriter(dirAddress,true);
It works fine.. But i also want to include current date in the file name...
The code is :
string dirAddress = "C:\\FTPTrace\\" + ipHeader.DestinationAddress.ToString() + DateTime.Now.ToShortDateString().ToString()+ ".txt";
System.IO.StreamWriter logfile = new System.IO.StreamWriter(dirAddress, true);
Now the file is not being created , an exception is raised
"A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll"
Kindly guide where am I wrong.... thanks...