how to save error log in xml file?

  • Thread starter Thread starter Dexter
  • Start date Start date
D

Dexter

Hello all,

i have a web application ASP.NET with VB.NET.
In the my global.asax file, i want to include a generic code that record all
errors in my application.
I try this:

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim appException As System.Exception = Server.GetLastError()
Dim erros As String = appException.ToString
Dim writer As New XmlTextWriter(Server.MapPath("erro.xml"),
System.Text.Encoding.ASCII)
writer.WriteStartDocument(True)
writer.WriteStartElement("Erro")
writer.WriteElementString("Erro", erros)
writer.WriteEndDocument()
writer.Close()
End Sub

But the execution this code don't finish, it goes only the line three, and
don't save the file.
Somebody know to make this task?

Thanks

Dexter
 
Back
Top