473,804 Members | 3,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Intermediate Class between HttpApplication and Global

Hy everybody,

I´m working on an ASP.NET framework and and I need to extend
System.Web.Http Application. I mean, I need to put some intermediate class
between System.Web.Http Application and Global class on Global.asax file.
What I need, in code, is the following:

public class MyhttpApplicati on : System.Web.Http Application

and then , Global class extends myHttpApplicati on

public class Global : MyHttpApplicati on

Till now, everything is ok, because nothing strange in on that. The
problem I found is that I need that both my class (MyHttpApplicat ion) and
the Global class (on the Global.asax file) listen the same events or can
write code for the same events, for example,Session _Start y
Application_Sta rt..
Why do I need this? Because I need to let the programmer works as he works
when Global extend HttpApplication and I also need to listen those events
because My Framework do something when those event ocurr.

The real problem is that ASP.NET at compile time, it generates explicit
calls to Application_Sta rt and Session_Start using Object_Event way.

protected void Application_Sta rt(Object sender, EventArgs e)
{
}

so I can´t have Application_Sta rt on both my class (MyHttpApplicat ion) and
the Global class, because is not possible to define the same method
signature without using the override, new or any keyword that may help.

I hope somebody has understood my problem and provide me a good solution
for my problem. I really need help cause my class needs to listen to those
events but I must let programmers to also listen to those events as the way
they did before.

Thanks in advance.

Fernando Arámburu
Nov 19 '05 #1
1 2239
Hello Fernando,

If Im not mistaken, you are probably after an IHttpModule [1]. There's an
article [2] that discusses an implementation available on MSDN.

[1] http://msdn.microsoft.com/library/de...ClassTopic.asp
[2] http://msdn.microsoft.com/library/de...ilterInASP.asp

--
Matt Berther
http://www.mattberther.com
Hy everybody,

I´m working on an ASP.NET framework and and I need to extend
System.Web.Http Application. I mean, I need to put some intermediate
class
between System.Web.Http Application and Global class on Global.asax
file.
What I need, in code, is the following:
public class MyhttpApplicati on : System.Web.Http Application

and then , Global class extends myHttpApplicati on

public class Global : MyHttpApplicati on

Till now, everything is ok, because nothing strange in on that.
The
problem I found is that I need that both my class (MyHttpApplicat ion)
and
the Global class (on the Global.asax file) listen the same events or
can
write code for the same events, for example,Session _Start y
Application_Sta rt..
Why do I need this? Because I need to let the programmer works as he
works
when Global extend HttpApplication and I also need to listen those
events
because My Framework do something when those event ocurr.
The real problem is that ASP.NET at compile time, it generates
explicit calls to Application_Sta rt and Session_Start using
Object_Event way.

protected void Application_Sta rt(Object sender, EventArgs e)
{
}
so I can´t have Application_Sta rt on both my class (MyHttpApplicat ion)
and the Global class, because is not possible to define the same
method signature without using the override, new or any keyword that
may help.

I hope somebody has understood my problem and provide me a good
solution for my problem. I really need help cause my class needs to
listen to those events but I must let programmers to also listen to
those events as the way they did before.

Thanks in advance.

Fernando Arámburu


Nov 19 '05 #2

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

Similar topics

2
2213
by: Jerry | last post by:
My "main" class is getting a bit long...Is it possble to split a class definition into several files and then import the pieces to get the whole definition? Jerry
7
1764
by: [Gauthier] | last post by:
Hello, I've a simple question: On a server that run multiple asp.net HttpApplication, is there any way with the asp.net framework to exchange data between different application? I basically need to send message to a 'server wide' application from any HttpApplication on the same server and obtain responses (wich may be simple strings or streams for example), this 'server wide' application is also
2
1640
by: Keith Chadwick | last post by:
Need some help on access the httpApplication cache. I was informed to use the application cache over the old application object and also to use a classes versus modules. do I need to Imprt System.Web.HttpApplication into the class? do I need to dim x as System.Web.Application then use x.context.cache.item("myitem")=myobject
6
1145
by: Daves | last post by:
can anyone imagine why I cannot access static variables in my global class from other pages, eg: myNumber = myGlobal.UserID; where global.asax contains: <%@ Application Language="C#" Classname="myGlobal" %> <script runat="server"> public static int UserID = 0; void Session_Start(Object sender, EventArgs e) {...}
2
1816
by: Shapper | last post by:
Hello, In the main root of my web site together with my aspx and aspx.vb files I have the file global.vb. This file has a class with all the functions which are used in many aspx.vb files and it is like this: Imports System Namespace Global
2
1568
by: parez | last post by:
Hi all! How many instances of the class httpapplication exist for a single webserver? Does it depened on the on the number of processors? I have a timer associated with the app and its declared in global.aspx.vb as public shared. Every two minutes it is suppose to do something.
8
1574
by: SStory | last post by:
When I right a class, I am wondering what are the best practices for error handling? Do I try..catch and trap the error and if so what do I do with it? Because most likely the class user will want to know the information in the exception.... That being the case do I just not catch it and let the user of the class catch it and get all the information? I know I could catch it and throw my own, but I'd have to tell them the same
15
2581
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the Global class. Note: I use these shared variables for read only values that are set at application start. It would appear the 2.0 doesn't like you to use shared variables in the global class. How do I convert my 1.1 applications to 2.0 without...
10
3583
by: ma | last post by:
Hello, I want to create a global class. To do this I did the followings: 1- Create a class name test. It has a public variable named mystring. public class test { public string mystring = "hello world";
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.