T
tshad
I have an example I copied from "programming asp.net" (o'reilly) and can't
seem to get the Sub (writefile) to execute. It displays all the
response.write lines that are called directly, but not any of the
response.write lines from inside the sub.
*******************************************
<%@ Application Language="VB" %>
<script runat="server">
protected sub Application_Start(ByVal Sender as Object, _
ByVal e as EventArgs)
WriteFile("Application Starting")
end sub
protected sub Application_End(ByVal Sender as Object, _
ByVal e as EventArgs)
WriteFile("Application Ending")
end sub
protected sub Session_Start(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Session_Start" + "<br/>")
end sub
protected sub Session_End(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Session_End" + "<br/>")
end sub
protected sub Application_Disposed(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_Disposed" + "<br/>")
end sub
protected sub Application_Error(ByVal Sender as Object, _
ByVal e as EventArgs)
dim strError as string
strError = Server.GetLastError().ToString()
Context.ClearError()
Response.Write("Application_Error" + "<br/>")
Response.Write("Error Msg: " & strError + "<br/>")
end sub
protected sub Application_BeginRequest(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_BeginRequest" + "<br/>")
end sub
protected sub Application_EndRequest(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_EndRequest" + "<br/>")
end sub
protected sub Application_AcquireRequestState(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_AcquireRequestState" + "<br/>")
end sub
protected sub Application_AuthenticateRequest(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_AuthenticateRequest" + "<br/>")
end sub
protected sub Application_AuthorizeRequest(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_AuthorizeRequest" + "<br/>")
end sub
protected sub Application_PostRequestHandlerExecute(ByVal Sender as
Object, _
ByVal e as EventArgs)
Response.Write("Application_PostRequestHandlerExecute" + "<br/>")
end sub
protected sub Application_PreRequestHandlerExecute(ByVal Sender as
Object, _
ByVal e as EventArgs)
Response.Write("Application_PreRequestHandlerExecute" + "<br/>")
end sub
protected sub Application_PreSendRequestContent(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_PreSendRequestContent" + "<br/>")
end sub
protected sub Application_PreSendRequestHeaders(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_PreSendRequestHeaders" + "<br/>")
end sub
protected sub Application_ReleaseRequestState(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_ReleaseRequestState" + "<br/>")
end sub
protected sub Application_ResolveRequestCache(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_ResolveRequestCache" + "<br/>")
end sub
protected sub Application_UpdateRequestCache(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_UpdateRequestCache" + "<br/>")
end sub
sub WriteFile(strText as string)
response.write("inside WriteFile <br>")
end sub
</script>
******************************************************************
Do I need to do something else to make this work?
It is a straight global.asax file in the root folder that is executing
correctly on my aspx page (except for the sub). At the moment I am passing
a string, but since I couldn't get it to work I just put a response.write
line in the sub.
Thanks,
Tom
seem to get the Sub (writefile) to execute. It displays all the
response.write lines that are called directly, but not any of the
response.write lines from inside the sub.
*******************************************
<%@ Application Language="VB" %>
<script runat="server">
protected sub Application_Start(ByVal Sender as Object, _
ByVal e as EventArgs)
WriteFile("Application Starting")
end sub
protected sub Application_End(ByVal Sender as Object, _
ByVal e as EventArgs)
WriteFile("Application Ending")
end sub
protected sub Session_Start(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Session_Start" + "<br/>")
end sub
protected sub Session_End(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Session_End" + "<br/>")
end sub
protected sub Application_Disposed(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_Disposed" + "<br/>")
end sub
protected sub Application_Error(ByVal Sender as Object, _
ByVal e as EventArgs)
dim strError as string
strError = Server.GetLastError().ToString()
Context.ClearError()
Response.Write("Application_Error" + "<br/>")
Response.Write("Error Msg: " & strError + "<br/>")
end sub
protected sub Application_BeginRequest(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_BeginRequest" + "<br/>")
end sub
protected sub Application_EndRequest(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_EndRequest" + "<br/>")
end sub
protected sub Application_AcquireRequestState(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_AcquireRequestState" + "<br/>")
end sub
protected sub Application_AuthenticateRequest(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_AuthenticateRequest" + "<br/>")
end sub
protected sub Application_AuthorizeRequest(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_AuthorizeRequest" + "<br/>")
end sub
protected sub Application_PostRequestHandlerExecute(ByVal Sender as
Object, _
ByVal e as EventArgs)
Response.Write("Application_PostRequestHandlerExecute" + "<br/>")
end sub
protected sub Application_PreRequestHandlerExecute(ByVal Sender as
Object, _
ByVal e as EventArgs)
Response.Write("Application_PreRequestHandlerExecute" + "<br/>")
end sub
protected sub Application_PreSendRequestContent(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_PreSendRequestContent" + "<br/>")
end sub
protected sub Application_PreSendRequestHeaders(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_PreSendRequestHeaders" + "<br/>")
end sub
protected sub Application_ReleaseRequestState(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_ReleaseRequestState" + "<br/>")
end sub
protected sub Application_ResolveRequestCache(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_ResolveRequestCache" + "<br/>")
end sub
protected sub Application_UpdateRequestCache(ByVal Sender as Object, _
ByVal e as EventArgs)
Response.Write("Application_UpdateRequestCache" + "<br/>")
end sub
sub WriteFile(strText as string)
response.write("inside WriteFile <br>")
end sub
</script>
******************************************************************
Do I need to do something else to make this work?
It is a straight global.asax file in the root folder that is executing
correctly on my aspx page (except for the sub). At the moment I am passing
a string, but since I couldn't get it to work I just put a response.write
line in the sub.
Thanks,
Tom