How to handle error while project running on live

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


Please Help Members By Posting Answers For Below Questions

Can you explain why it is useful to use mvc instead of webforms? : asp.net mvc

643


Describe a Windows Service and its lifecycle ?

721


What is the purpose of session management?

597


How do u declare static variable and how it is declared and what is its lifetime?

602


Elaborate differentiation between ViewState and SessionState?

712






What are the cookies types in asp.net?

644


Can action method static?

638


WSDL means?

765


Differentiate between file-based dependency and key-based dependency.

613


What is anonymous authentication?

675


What is asp.net and its advantages?

619


How does asp page work?

630


Can you clarified A Web service can only be written in .NET or not?

633


What is asp.net file?

724


What are the advantages of using sql stored procedures instead of adhoc sql queries in an asp.net web application?

688