• 0

Trap application errors in Global.asax Problem [VB.Net]


Question

Hi All,

Im trying to trap application errors in my global.asax but Im getting an error on initialisation of my logmanagerclkass due to "Illegal characters in path". The global.asax routine looks like as follows:

Sub Application_Error(ByVal sender as Object, ByVal e As EventArgs)

Dim ex as exception = Server.GetLastError

If ex.ConfigurationManager.AppSettings("logDirectory") Is Nothing Then

Logmanager.WriteEntry("Global error-"&infor from global.asax:"&ex.Message)

Else

If not ex.innerexception.InnerException is nothing then

Logmanager.WriteEntry("Global error-"& info from global.asax:"&ex.Message & InnerException msg:"&ex.InnerException.InnerException.Message)

Else

Logmanager.WriteEntry("Global error-"& info from global.asax:"&ex.Message & InnerException msg:"&ex.InnerException.Message)

End If

End If

Server.ClearError()

Server.Transfer("~/ErrorPages/ServerError.aspx")

End Sub

My logmanager fails on:

Private Shared _logDir As String = ConfigurationMnaager.AppSettings("logDirectory")

Somehow the ConfigurationMnaager.AppSettings("logDirectory") gets replaced with ConfigurationMnaager.AppSettings("Illegal characters in path") and therefore an error is thrown as the web.config entry is not found.

<add key ="logDirectory" value="C:\WebCom4logs\"/>

Please can someone help, Im lost and have no idea where to go from here?

Many Thanks

Edited by Jigsaw
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.