Reputation: 61
In ASP Classic can i use Response.AppendToLog
in global.asa Application_onStart
?
I would try to Log error when application starts, but i always get this error:
erreur '8002802b'
/v1/common/CAppInit.asp, line 21
line 21:
Response.AppendToLog "INIT DB ERROR"
Upvotes: 1
Views: 203
Reputation: 16682
You can’t use the Response
object in the global.asa
file because there is no context for a response. The global.asa
file deals with Application
and Session
level context.
If you think about it, when the application starts there doesn’t need to be a response because there is no initial request, it operates entirely outside of that pipeline.
The definition of the Response.AppendToLog()
method is as follows;
The AppendToLog method adds a string to the end of the Web server log entry for the request.
This means that an initial request is required, which makes using it in the context of application startup impossible.
The usual solution is to implement a custom logging function that can be utilised inside the context of the Application
or Session
startup events.
Upvotes: 2