472,363 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,363 software developers and data experts.

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(ByVal Sender as
Object, _
ByVal e as EventArgs)
Response.Write("Application_PostRequestHandlerExec ute" + "<br/>")
end sub

protected sub Application_PreRequestHandlerExecute(ByVal Sender as
Object, _
ByVal e as EventArgs)
Response.Write("Application_PreRequestHandlerExecu te" + "<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
Jul 22 '05 #1
2 2126
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"
Jul 22 '05 #2
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OC*************@TK2MSFTNGP14.phx.gbl...
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.


Actually, I do use the .net group, but I accidently posted it here. Sorry.

Tom
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"

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: .Net Sports | last post by:
I have had to move my files to another machine, and re-install visualstudio.net2003 and re-integrate my project into the IDE. When trying to run/f5 debug , I'm getting a Could Not Load type...
9
by: tshad | last post by:
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...
2
by: Nathan Sokalski | last post by:
I would like to access variables and functions that I declare in the Global.asax.vb file. However, I am having trouble doing that. What does the declaration have to look like in the Global.asax.vb...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
2
by: Steve | last post by:
I am new to this newsgroup & to .NET in general. I have been playing around with Visual Studio .NET, building and rendering web pages using VB "code behind" files. My problem / question is; How...
6
by: Mark Rae | last post by:
Hi, When you create a new web site in VS.NET 2005, it doesn't contain a Global.asax file by default and, when you add one manually, it creates a Global.asax file with in-line code e.g. <%@...
0
by: hynek.cihlar | last post by:
A strange behaviour thatI found in ASP.NET 2.0. I am trying to issue a callback request (handled by ICallbackEventHandler and RaiseCallbackEvent) and a regular GET request in the client browser...
4
by: Larry Epn | last post by:
Simple question: I have a c# asp.net project that was given to me. It has the c# code within the <scriptsection of the global.asax file. I would rather have it in separate files; e.g.,...
4
by: Hardy Wang | last post by:
Hi all, In order to solve code-behind of global.asax problem, I removed the code from global.asax, and just leave one line "<%@ Application Language="C#" Inherits="Global"%>" in this file. Then I...
3
by: teo | last post by:
I have two .aspx pages they use two different Global.asax files when I "Publish" the first .aspx page, its Global.asax is transformed in App_global.asax.compiled App_global.asax.dll to put...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.