Hi All,
I am getting Some errors in my application.
Now i need to log that error into notepad through my catch my block
how can i achieve this
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
SIVAPosted Jan 10, 2012, 8:05 AM
Anuja PawarPosted Jan 10, 2012, 7:35 AM
Refer this article for complete guidance
http://imar.spaanjaars.com/275/logging-errors-to-the-event-log-in-aspnet-applications
Pravin GhadgePosted Jan 10, 2012, 7:14 AM
catch (Exception ex)
{
writeFile(ex.Message);
}
public void writeFile(string strWrite)
{
FileStream fs = new FileStream(@"c:\Temp\tmp.txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(strWrite);
m_streamWriter.Flush();
m_streamWriter.Close();
}
Ankit ShivnakrPosted Jan 10, 2012, 7:12 AM
Shiv Try this code
try
{
// Your code plase
}
catch (Exception exception2)