Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Exception:

The UNC path should be of the form \\server\share.

i am creating a log file for maintaining a log and error. but its showing a exception.

C#
string dir = HttpRuntime.AppDomainAppVirtualPath + "\\Log Files";

             if (!System.IO.Directory.Exists(dir))
             {
                 System.IO.Directory.CreateDirectory(dir);

             }


             string logFile = dir + "\\ErrorLog.txt";


it is firing exception after line System.IO.Directory.CreateDirectory(dir);
this exception is shown after deployig website is it releted to deplyment?

plz help.
Posted
Comments
F-ES Sitecore 25-Aug-15 8:57am    
user Server.MapPath to get the path to physical directories on the server.

https://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath(v=vs.110).aspx
Sinisa Hajnal 25-Aug-15 9:09am    
Also check that the user under which the site is running has enough rights to create the folder.
virusstorm 25-Aug-15 12:48pm    
What is the exception?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900