Hi , it´s me again.
I will take another way because yesterday I make a question and,
probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the
Application Start event. I know there is one way, in Global.asax writing
code in
Application_Start
but this way is not possible for me because I need to do it without
implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method);
Do you know if ApplicacionStart event is declared somewhere on the
framework so I can register to it?
Thanks in advance
Fernando Arámburu 16 3127
Have you tried making an httpmodule to do this?
KG
"Fernando Arámburu" <fe**************@speedy.com.ar> wrote in message
news:Ou**************@TK2MSFTNGP10.phx.gbl... Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method);
Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance
Fernando Arámburu
Well, you can implement a Custom HTTP Module: http://msdn.microsoft.com/library/de...ttpmodules.asp
which has the init() method....
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Fernando Arámburu" <fe**************@speedy.com.ar> wrote in message
news:Ou**************@TK2MSFTNGP10.phx.gbl... Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new
EventHandler(My_Method); Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance
Fernando Arámburu
HttpModules can't handle the Application_Start, Application_End, Session_Start
or Session_End events. They aren't proper events -- there's code in ASP.NET
that's hard coded to look for these and call them directly.
-Brock
DevelopMentor http://staff.develop.com/ballen Have you tried making an httpmodule to do this?
KG
"Fernando Arámburu" <fe**************@speedy.com.ar> wrote in message news:Ou**************@TK2MSFTNGP10.phx.gbl...
Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method);
Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance Fernando Arámburu
Thanks for the answer.
Even though it does not help too much to my problem, just thanks for telling
me that bad thing I was thinking on: "it´s only a hardcode and there are no
events"
REALLY BAD NEWS.
Thanks again.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje
news:19**********************@msnews.microsoft.com ... HttpModules can't handle the Application_Start, Application_End,
Session_Start or Session_End events. They aren't proper events -- there's code in
ASP.NET that's hard coded to look for these and call them directly.
-Brock DevelopMentor http://staff.develop.com/ballen Have you tried making an httpmodule to do this?
KG
"Fernando Arámburu" <fe**************@speedy.com.ar> wrote in message news:Ou**************@TK2MSFTNGP10.phx.gbl...
Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method);
Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance Fernando Arámburu
HttpModule can´t manage Application Start and Session Start. I only need to
catch those moments and I can´t do that in Global.asax file because I can´t
put code in user code.
I´m working on a Framework that programmers use to improve some ASP.NET
features I can´t put code in user code.
Thanks for the answer.
Fernando Arámburu
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
escribió en el mensaje news:uH**************@TK2MSFTNGP15.phx.gbl... Well, you can implement a Custom HTTP Module: http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconcustomhttpmodules.asp which has the init() method....
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!) "Fernando Arámburu" <fe**************@speedy.com.ar> wrote in message news:Ou**************@TK2MSFTNGP10.phx.gbl... Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my
question. I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method); Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance
Fernando Arámburu
Why can't you just have a type initializer (static constructor)? This is
an easy way to get one-time initilization semantics.
public class MyClass
{
static MyClass()
{
// do your one-time init here
}
}
-Brock
DevelopMentor http://staff.develop.com/ballen Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method);
Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance Fernando Arámburu
Static constructors are lazy-loaded...meaning it won't necessarily run on
application start, but rather when the first member (static or instance) of
the class is called...
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:19**********************@msnews.microsoft.com ... Why can't you just have a type initializer (static constructor)? This is an easy way to get one-time initilization semantics.
public class MyClass { static MyClass() { // do your one-time init here } }
-Brock DevelopMentor http://staff.develop.com/ballen Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method);
Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance Fernando Arámburu
And where am I working with Application Start and Session Start? I mean, you
are talking about one-time initialization that is completely different from
what i need. I need to some things when Application Start and when Session
Start.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje
news:19**********************@msnews.microsoft.com ... Why can't you just have a type initializer (static constructor)? This is an easy way to get one-time initilization semantics.
public class MyClass { static MyClass() { // do your one-time init here } }
-Brock DevelopMentor http://staff.develop.com/ballen Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method);
Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance Fernando Arámburu
Yes of course. But for many scenarios this is perfectly acceptable.
-Brock
DevelopMentor http://staff.develop.com/ballen Static constructors are lazy-loaded...meaning it won't necessarily run on application start, but rather when the first member (static or instance) of the class is called...
Karl
Ah, I wasn't aware you also needed Session_Start semantics -- your original
post didn't mention this at all.
What is it that you need to do at application startup?
As for the Session_Start, you may be out of luck given ASP.NET's implementation
that calls Session_Start in global.asax.
-Brock
DevelopMentor http://staff.develop.com/ballen And where am I working with Application Start and Session Start? I mean, you are talking about one-time initialization that is completely different from what i need. I need to some things when Application Start and when Session Start.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje news:19**********************@msnews.microsoft.com ...
Why can't you just have a type initializer (static constructor)? This is an easy way to get one-time initilization semantics.
public class MyClass { static MyClass() { // do your one-time init here } } -Brock DevelopMentor http://staff.develop.com/ballen Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method); Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance Fernando Arámburu
I need to load some things to the Application object collection.I need to
create some object and put the most important one on the Application objects
collection so I can get it on every request.
I don´t understand what you say about Session_Start and out of luck ......
Can you say that in other words?
Just one thing, I can't touch Global.asax file because I need to compile
what I´m doing an generate a closed dll so Global.asax file can not be
included. The only thing I can do with Global.asax is that Global class
defined there inherits from one MyHttpApplication written by me and that
MyHttpApplication inherits from original System.Web.HttpApplication
Thanks in advance.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje
news:20**********************@msnews.microsoft.com ... Ah, I wasn't aware you also needed Session_Start semantics -- your
original post didn't mention this at all.
What is it that you need to do at application startup?
As for the Session_Start, you may be out of luck given ASP.NET's
implementation that calls Session_Start in global.asax.
-Brock DevelopMentor http://staff.develop.com/ballen And where am I working with Application Start and Session Start? I mean, you are talking about one-time initialization that is completely different from what i need. I need to some things when Application Start and when Session Start.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje news:19**********************@msnews.microsoft.com ...
Why can't you just have a type initializer (static constructor)? This is an easy way to get one-time initilization semantics.
public class MyClass { static MyClass() { // do your one-time init here } } -Brock DevelopMentor http://staff.develop.com/ballen Hi , it´s me again.
I will take another way because yesterday I make a question and, probably I didn´t make myself clear so you didn´t understand my question.
I want to know if there is any way to register a method to the Application Start event. I know there is one way, in Global.asax writing code in
Application_Start
but this way is not possible for me because I need to do it without implementing those methods in global.asax
What i need is something like:
AnyDotNetFrameworkClass.ApplicationStart += new EventHandler(My_Method); Do you know if ApplicacionStart event is declared somewhere on the framework so I can register to it? Thanks in advance Fernando Arámburu
Why does your application wide data need to be in the ASP.NET Application
object? If you can't find a workaround to your problem, keeping that data
in static variables will have the same effect.
So you do have control over the global.asax? Meaning, you can specify the
Inherits directive? If so, then you can do these things you're talking about
-- in your HttpApplication derived class, add Session_Start and whatever
else you need. Didn't you try this already? I don't have the original post,
so my apologies if you've already mentioned that.
-Brock
DevelopMentor http://staff.develop.com/ballen I need to load some things to the Application object collection.I need to create some object and put the most important one on the Application objects collection so I can get it on every request.
I don´t understand what you say about Session_Start and out of luck ...... Can you say that in other words? Just one thing, I can't touch Global.asax file because I need to compile what I´m doing an generate a closed dll so Global.asax file can not be included. The only thing I can do with Global.asax is that Global class defined there inherits from one MyHttpApplication written by me and that MyHttpApplication inherits from original System.Web.HttpApplication Thanks in advance.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje news:20**********************@msnews.microsoft.com ...
Ah, I wasn't aware you also needed Session_Start semantics -- your original
post didn't mention this at all.
What is it that you need to do at application startup?
As for the Session_Start, you may be out of luck given ASP.NET's implementation
that calls Session_Start in global.asax.
-Brock DevelopMentor http://staff.develop.com/ballen And where am I working with Application Start and Session Start? I mean, you are talking about one-time initialization that is completely different from what i need. I need to some things when Application Start and when Session Start.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje news:19**********************@msnews.microsoft.com ...
Why can't you just have a type initializer (static constructor)? This is an easy way to get one-time initilization semantics.
public class MyClass { static MyClass() { // do your one-time init here } } -Brock DevelopMentor http://staff.develop.com/ballen > Hi , it´s me again. > > I will take another way because yesterday I make a question and, > probably I didn´t make myself clear so you didn´t understand my > question. > > I want to know if there is any way to register a method to the > Application Start event. I know there is one way, in Global.asax > writing code in > > Application_Start > > but this way is not possible for me because I need to do it > without implementing those methods in global.asax > > What i need is something like: > > AnyDotNetFrameworkClass.ApplicationStart += new > EventHandler(My_Method); > Do you know if ApplicacionStart event is declared somewhere on the > framework so I can register to it? > Thanks in advance > Fernando Arámburu
> Why does your application wide data need to be in the ASP.NET Application object? If you can't find a workaround to your problem, keeping that data in static variables will have the same effect.
The problem with static variables is that initialization ocurrs with the
first call to an object of this class and I want to load those object when
the application start. Even though, for now is a good solution.
So you do have control over the global.asax? Meaning, you can specify the Inherits directive? If so, then you can do these things you're talking
about -- in your HttpApplication derived class, add Session_Start and whatever else you need. Didn't you try this already?.
I tried this solution. The problem I found with this is that if I use
Session_Start method (just for example I put Session_Start, with
Application_Start is the same problem) then programmers can´t write on their
Session_Start method of the Global class, because I have override their
Session_Start method.
Do you understand what I try to say?
Do you have any idea of how I can do that in that intermediate class
MyHttpApplicaiton?
I don't have the original post, so my apologies if you've already
mentioned that
Don´t worry about the originial post and thanks a lot for answer,
Fernando Arámburu -Brock DevelopMentor http://staff.develop.com/ballen I need to load some things to the Application object collection.I need to create some object and put the most important one on the Application objects collection so I can get it on every request.
I don´t understand what you say about Session_Start and out of luck ...... Can you say that in other words? Just one thing, I can't touch Global.asax file because I need to compile what I´m doing an generate a closed dll so Global.asax file can not be included. The only thing I can do with Global.asax is that Global class defined there inherits from one MyHttpApplication written by me and that MyHttpApplication inherits from original System.Web.HttpApplication Thanks in advance.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje news:20**********************@msnews.microsoft.com ...
Ah, I wasn't aware you also needed Session_Start semantics -- your original
post didn't mention this at all.
What is it that you need to do at application startup?
As for the Session_Start, you may be out of luck given ASP.NET's implementation
that calls Session_Start in global.asax.
-Brock DevelopMentor http://staff.develop.com/ballen And where am I working with Application Start and Session Start? I mean, you are talking about one-time initialization that is completely different from what i need. I need to some things when Application Start and when Session Start.
Fernando Arámburu
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje news:19**********************@msnews.microsoft.com ...
> Why can't you just have a type initializer (static constructor)? > This is an easy way to get one-time initilization semantics. > > public class MyClass > { > static MyClass() > { > // do your one-time init here > } > } > -Brock > DevelopMentor > http://staff.develop.com/ballen >> Hi , it´s me again. >> >> I will take another way because yesterday I make a question and, >> probably I didn´t make myself clear so you didn´t understand my >> question. >> >> I want to know if there is any way to register a method to the >> Application Start event. I know there is one way, in Global.asax >> writing code in >> >> Application_Start >> >> but this way is not possible for me because I need to do it >> without implementing those methods in global.asax >> >> What i need is something like: >> >> AnyDotNetFrameworkClass.ApplicationStart += new >> EventHandler(My_Method); >> Do you know if ApplicacionStart event is declared somewhere on the >> framework so I can register to it? >> Thanks in advance >> Fernando Arámburu
> The problem with static variables is that initialization ocurrs with the first call to an object of this class and I want to load those object when the application start. Even though, for now is a good solution.
Are you sure you need it to run immediaetly when the app starts up and can't
wait until the first time you need this application wide data? I'd imagine
in 90% of the cases the difference between the two (time-wise) won't be a
whole heck of a lot... But of course it's not called until the first time
it's requested... which as I mentioned before, is acceptable in many scenarios.
The only sort of scenario where I don't see this being acceptable is where
your Application_Start needs (or the equivalent thereof) needs to push some
information out of the application such as sending an email, or going out
to the database to log that the application has started, or write to the
event log, etc... So yeah, those scenarios it's not the right approach for.
But if what you're doing is simply preloading and/or initializing app-wide
data, then the static ctor should be fine. Anyway, it's your app, so you
know best which of these approaches is right for you.
I tried this solution. The problem I found with this is that if I use Session_Start method (just for example I put Session_Start, with Application_Start is the same problem) then programmers can´t write on their Session_Start method of the Global class, because I have override their Session_Start method. Do you understand what I try to say? Do you have any idea of how I can do that in that intermediate class MyHttpApplicaiton?
It sounds like you're going to have to build your own publish/subscribe eventing
mechanism for these notifications to allow the flexiblity you have been talking
about.
-Brock
DevelopMentor http://staff.develop.com/ballen
Hi again,
Thanks very much for all the answers.
About the first point of the conversation, you are probably on the right
way. I mean, I want to do it on the Application Start but I think that I can
run that script as static so thanks a lot.
About the second point, yes, you are completelly right. It sounds like I
will have to build my own publish/subscribe eventing mechanism for these
notifications to allow the flexiblity I have been talking about.
Thanks a lot again and I wish I could help you in something
bye for now.
Fernando Arámburu
PS: I put on my favourites your blog so I start reading something about
ASP.NET 2.0 ;)
"Brock Allen" <ba****@NOSPAMdevelop.com> escribió en el mensaje
news:21**********************@msnews.microsoft.com ... The problem with static variables is that initialization ocurrs with the first call to an object of this class and I want to load those object when the application start. Even though, for now is a good solution. Are you sure you need it to run immediaetly when the app starts up and
can't wait until the first time you need this application wide data? I'd imagine in 90% of the cases the difference between the two (time-wise) won't be a whole heck of a lot... But of course it's not called until the first time it's requested... which as I mentioned before, is acceptable in many
scenarios. The only sort of scenario where I don't see this being acceptable is where your Application_Start needs (or the equivalent thereof) needs to push
some information out of the application such as sending an email, or going out to the database to log that the application has started, or write to the event log, etc... So yeah, those scenarios it's not the right approach
for. But if what you're doing is simply preloading and/or initializing app-wide data, then the static ctor should be fine. Anyway, it's your app, so you know best which of these approaches is right for you.
I tried this solution. The problem I found with this is that if I use Session_Start method (just for example I put Session_Start, with Application_Start is the same problem) then programmers can´t write on their Session_Start method of the Global class, because I have override their Session_Start method. Do you understand what I try to say? Do you have any idea of how I can do that in that intermediate class MyHttpApplicaiton? It sounds like you're going to have to build your own publish/subscribe
eventing mechanism for these notifications to allow the flexiblity you have been
talking about.
-Brock DevelopMentor http://staff.develop.com/ballen
If you are developing an extensible framework, perhaps you could write
your own Global.asax class with protected Application_Start and
Session_Start members so that when your users inherit from your global
class, they can override your App_start and Ses_start methods as
needed, calling base.app_start or base.ses_start as needed.
This seems to be the way many OO frameworks are designed.
Alternatively, build your own App_start and Ses_start methods and
expose events that your users can hook into so that they don't need to
call these methods directly. This would seem to let you control the
timing of whether your method or theirs gets executed first... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: serge calderara |
last post by:
Dear all,
I have an application which is suppose to start another executable process.
As soon as that process is running, I need to retrive its handle. The
problem of the particular process I am...
|
by: orekin |
last post by:
Hi There
I have been trying to come to grips with Application.Run(),
Application.Exit() and the Message Pump and I would really appreciate
some feedback on the following questions .. There are...
|
by: =?Utf-8?B?Vmlua2k=?= |
last post by:
Hello Everyone,
I have an exe application that I want to start remotely.Once I start the
application,
I want to press ok to that application. To start the application, I did...
|
by: Cramer |
last post by:
Using ASP.NET 3.5: Can a custom HTTP Module be used to register for the
Application_Start event? Or _must_ I use Global.asax to work with
Application.Start?
I understand that I can use a custom...
|
by: Cramer |
last post by:
Using ASP.NET 3.5: Can a custom HTTP Module be used to register for the
Application_Start event? Or _must_ I use Global.asax to work with
Application.Start?
I understand that I can use a custom...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |