L
Leon
I wrote an custom error handler that works, but why the ErrorLog.txt file is
being created/written in the root web instead of the folder within my web
application?
Root web = C:\Inetpub\wwwroot -&- Web Application Folder =
C:\Inetpub\wwwroot\MySite
See code:
Public Shared Sub LogError(ByVal message As String)
' Get the current HTTPContext
Dim context As HttpContext = HttpContext.Current
' Get location of ErrorLogFile from Web.config file
Dim filePath As String = context.Server.MapPath( "../../ErrorLog.txt")
' Write message to error file
Try
Dim sw As New System.IO.StreamWriter(filePath, True)
sw.WriteLine(message)
sw.WriteLine()
sw.Close()
Catch
' If error writing to file, simply continue
End Try
End Sub
End Class
End Namespace
and if I try to hard code write the error to my ErrorLog text file it in my
web application (such as "MySite/ErrorLog.txt") nothing gets written?
being created/written in the root web instead of the folder within my web
application?
Root web = C:\Inetpub\wwwroot -&- Web Application Folder =
C:\Inetpub\wwwroot\MySite
See code:
Public Shared Sub LogError(ByVal message As String)
' Get the current HTTPContext
Dim context As HttpContext = HttpContext.Current
' Get location of ErrorLogFile from Web.config file
Dim filePath As String = context.Server.MapPath( "../../ErrorLog.txt")
' Write message to error file
Try
Dim sw As New System.IO.StreamWriter(filePath, True)
sw.WriteLine(message)
sw.WriteLine()
sw.Close()
Catch
' If error writing to file, simply continue
End Try
End Sub
End Class
End Namespace
and if I try to hard code write the error to my ErrorLog text file it in my
web application (such as "MySite/ErrorLog.txt") nothing gets written?