Home > Archive > ASP > February 2005 > Can't get Global.asax to execute Sub
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Can't get Global.asax to execute Sub
|
|
|
| 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(By
Val Sender as
Object, _
ByVal e as EventArgs)
Response.Write("Application_PostRequestHandlerExecute" + "<br/>")
end sub
protected sub Application_PreRequestHandlerExecute(ByV
al 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
| |
| Bob Barrows [MVP] 2005-02-23, 3:55 pm |
| tshad wrote:
> I have an example I copied from "programming asp.net" (o'reilly) and
There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
> 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.
The Response object is usually not available in any of these event
procedures, at least in classic asp, and I assume it's the same in dotnet.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
| |
|
| "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:OCjsffdGFHA.400@TK2MSFTNGP14.phx.gbl...
> tshad wrote:
>
> There was no way for you to know it, but this is a classic asp newsgroup.
> While you may be lucky enough to find a dotnet-savvy person here who can
> answer your question, you can eliminate the luck factor by posting your
> question to a group where those dotnet-savvy people hang out. I suggest
> microsoft.public.dotnet.framework.aspnet.
Actually, I do use the .net group, but I accidently posted it here. Sorry.
Tom
>
>
> The Response object is usually not available in any of these event
> procedures, at least in classic asp, and I assume it's the same in dotnet.
>
> Bob Barrows
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
|
|
|
|
|