Step1:-
Copy these two methods into code file and access the those methods in your
project where you want
public void
ExceptionHandler(string ExceptionMessage)
{
try
{
// string root =
Directory.GetCurrentDirectory() + "\\Log";
// if (!Directory.Exists(root))
// {
// Directory.CreateDirectory(root);
// }
string root = "C:\\Log\\";
string path = root + "SampleLog" + System.DateTime.Now.ToString("ddMMyyy")
+ ".txt";
CallExceptionHandler(path, ExceptionMessage);
}
catch (Exception)
{
}
}