Answer Posted / tiger skumar
Its very essential to track the error in the live server.
When end user use the project, some error may come on live
server. We can use the an email id to capture them in the
exception block and sends them email.
try
{
----
----
----
}
catch(Exception oEx)
{
MailMessage oMM = new MailMessage();
oMM.To ="skumaar_mca@yahoo.com";
oMM.Subject = oEx.ToString();
StringBuilder oSB = new StringBuilder();
oSB.Append("Browser:"+Request.Browser);
oSB.Append("Url:"+Request.Url);
oSB.Append("IP Address:"+Request.UserHostAddress);
oSB.Append("Error:"+oEx.Message());
oMM.Body = oSB.ToString();
SmtpClient.Send(oMM);
This is sample coding for how to capture in the liver server.
No need to the write the above piece of coding in the every
place.
Just create an project and put the code in that class.
We can use the error message to that class and we can send
the email from there.
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Describe a Windows Service and its lifecycle ?
Where session variables are stored?
What is the difference between application state and caching?
What is the difference between web config and machine config files?
What is session object? Describe in detail.
What is request and response in asp.net?
Can I have a unique key as foreign key?
Why will you usually create an aspnet user account in the database for an asp.net web application?
Why session is more secure than cookies?
Can we have multiple web config files for an asp.net application?
What is data cache in sql server?
What is csrf attack in asp.net?
What is difference between session and application in asp net?
How is it possible for .NET to support many languages?
What is postback in asp net?