Friday, February 18, 2011

Create Error File

public void LogErrorToFile(string strPageName, string strMsg)
    {
        string strLogFilePath = System.Web.HttpContext.Current.Server.MapPath("~/Log/StateContractEmployee.txt");
        System.IO.File.AppendAllText(strLogFilePath, Environment.NewLine + strPageName + " : " + System.DateTime.Now.ToString() + " -- '" + strMsg + "'" + Environment.NewLine);
    }

No comments:

Post a Comment