Home All Groups Group Topic Archive Search About

How to stop processing request in global.asax

Author
7 Jan 2006 7:53 PM
GS
What would be the sample code to stop processing any further requests in
Application_onStart within global.asax has failed? Response.End does not
work since there is no response object at the point of initializion.

Author
7 Jan 2006 7:57 PM
Karl Seguin [MVP]
OnStart happens before any request is in the pipeline.

Personally, I'd stick a value in the web.config and read said value in
BeginRequest.  if it's true, I'd simply Response.End there.

Karl

Show quote
"GS" <n*@no.com> wrote in message
news:unLTGQ8EGHA.2380@TK2MSFTNGP12.phx.gbl...
> What would be the sample code to stop processing any further requests in
> Application_onStart within global.asax has failed? Response.End does not
> work since there is no response object at the point of initializion.
>
Author
7 Jan 2006 8:12 PM
GS
So how exactly I do that?
I don't know which page will be access first so in which page
"begin_request" event I need to put this in?
Generally what is prefered way to handle application initialization failures
in ASP.NET?

G


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
Show quote
net> wrote in message news:%23xUZdS8EGHA.2648@TK2MSFTNGP11.phx.gbl...
> OnStart happens before any request is in the pipeline.
>
> Personally, I'd stick a value in the web.config and read said value in
> BeginRequest.  if it's true, I'd simply Response.End there.
>
> Karl
>
> --
> http://www.openmymind.net/
>
>
>
> "GS" <n*@no.com> wrote in message
> news:unLTGQ8EGHA.2380@TK2MSFTNGP12.phx.gbl...
>> What would be the sample code to stop processing any further requests in
>> Application_onStart within global.asax has failed? Response.End does not
>> work since there is no response object at the point of initializion.
>>
>
>
Author
7 Jan 2006 8:32 PM
Karl Seguin [MVP]
Begin Request is an event of the Global.asax

Karl

Show quote
"GS" <n*@no.com> wrote in message
news:uh$ira8EGHA.868@TK2MSFTNGP10.phx.gbl...
> So how exactly I do that?
> I don't know which page will be access first so in which page
> "begin_request" event I need to put this in?
> Generally what is prefered way to handle application initialization
> failures in ASP.NET?
>
> G
>
>
> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
> net> wrote in message news:%23xUZdS8EGHA.2648@TK2MSFTNGP11.phx.gbl...
>> OnStart happens before any request is in the pipeline.
>>
>> Personally, I'd stick a value in the web.config and read said value in
>> BeginRequest.  if it's true, I'd simply Response.End there.
>>
>> Karl
>>
>> --
>> http://www.openmymind.net/
>>
>>
>>
>> "GS" <n*@no.com> wrote in message
>> news:unLTGQ8EGHA.2380@TK2MSFTNGP12.phx.gbl...
>>> What would be the sample code to stop processing any further requests in
>>> Application_onStart within global.asax has failed? Response.End does not
>>> work since there is no response object at the point of initializion.
>>>
>>
>>
>
>
Author
7 Jan 2006 8:35 PM
GS
Thanks,

I use VS 2005 and it does not have this event when it created global.asax.


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
Show quote
net> wrote in message news:%23MT4$l8EGHA.3920@TK2MSFTNGP09.phx.gbl...
> Begin Request is an event of the Global.asax
>
> Karl
>
> --
> http://www.openmymind.net/
>
>
>
> "GS" <n*@no.com> wrote in message
> news:uh$ira8EGHA.868@TK2MSFTNGP10.phx.gbl...
>> So how exactly I do that?
>> I don't know which page will be access first so in which page
>> "begin_request" event I need to put this in?
>> Generally what is prefered way to handle application initialization
>> failures in ASP.NET?
>>
>> G
>>
>>
>> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
>> net> wrote in message news:%23xUZdS8EGHA.2648@TK2MSFTNGP11.phx.gbl...
>>> OnStart happens before any request is in the pipeline.
>>>
>>> Personally, I'd stick a value in the web.config and read said value in
>>> BeginRequest.  if it's true, I'd simply Response.End there.
>>>
>>> Karl
>>>
>>> --
>>> http://www.openmymind.net/
>>>
>>>
>>>
>>> "GS" <n*@no.com> wrote in message
>>> news:unLTGQ8EGHA.2380@TK2MSFTNGP12.phx.gbl...
>>>> What would be the sample code to stop processing any further requests
>>>> in Application_onStart within global.asax has failed? Response.End does
>>>> not work since there is no response object at the point of
>>>> initializion.
>>>>
>>>
>>>
>>
>>
>
>
Author
7 Jan 2006 9:54 PM
Karl Seguin [MVP]
but you found it, right?

Karl

Show quote
"GS" <n*@no.com> wrote in message
news:%23wnJsn8EGHA.2912@tk2msftngp13.phx.gbl...
> Thanks,
>
> I use VS 2005 and it does not have this event when it created global.asax.
>
>
> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
> net> wrote in message news:%23MT4$l8EGHA.3920@TK2MSFTNGP09.phx.gbl...
>> Begin Request is an event of the Global.asax
>>
>> Karl
>>
>> --
>> http://www.openmymind.net/
>>
>>
>>
>> "GS" <n*@no.com> wrote in message
>> news:uh$ira8EGHA.868@TK2MSFTNGP10.phx.gbl...
>>> So how exactly I do that?
>>> I don't know which page will be access first so in which page
>>> "begin_request" event I need to put this in?
>>> Generally what is prefered way to handle application initialization
>>> failures in ASP.NET?
>>>
>>> G
>>>
>>>
>>> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
>>> net> wrote in message news:%23xUZdS8EGHA.2648@TK2MSFTNGP11.phx.gbl...
>>>> OnStart happens before any request is in the pipeline.
>>>>
>>>> Personally, I'd stick a value in the web.config and read said value in
>>>> BeginRequest.  if it's true, I'd simply Response.End there.
>>>>
>>>> Karl
>>>>
>>>> --
>>>> http://www.openmymind.net/
>>>>
>>>>
>>>>
>>>> "GS" <n*@no.com> wrote in message
>>>> news:unLTGQ8EGHA.2380@TK2MSFTNGP12.phx.gbl...
>>>>> What would be the sample code to stop processing any further requests
>>>>> in Application_onStart within global.asax has failed? Response.End
>>>>> does not work since there is no response object at the point of
>>>>> initializion.
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
8 Jan 2006 12:10 AM
GS
Yes,

Thanks for all your help.
The problem now is that BeginRequest is being executed for each new request
coming in and I want to stop processing anything if stuff in
Application_onStart was not initialized properly so BeginRequest is not
really a choice here.

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
Show quote
net> wrote in message news:ey0$hT9EGHA.1028@TK2MSFTNGP11.phx.gbl...
> but you found it, right?
>
> Karl
>
> --
> http://www.openmymind.net/
>
>
>
> "GS" <n*@no.com> wrote in message
> news:%23wnJsn8EGHA.2912@tk2msftngp13.phx.gbl...
>> Thanks,
>>
>> I use VS 2005 and it does not have this event when it created
>> global.asax.
>>
>>
>> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
>> net> wrote in message news:%23MT4$l8EGHA.3920@TK2MSFTNGP09.phx.gbl...
>>> Begin Request is an event of the Global.asax
>>>
>>> Karl
>>>
>>> --
>>> http://www.openmymind.net/
>>>
>>>
>>>
>>> "GS" <n*@no.com> wrote in message
>>> news:uh$ira8EGHA.868@TK2MSFTNGP10.phx.gbl...
>>>> So how exactly I do that?
>>>> I don't know which page will be access first so in which page
>>>> "begin_request" event I need to put this in?
>>>> Generally what is prefered way to handle application initialization
>>>> failures in ASP.NET?
>>>>
>>>> G
>>>>
>>>>
>>>> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO .
>>>> ANDME net> wrote in message
>>>> news:%23xUZdS8EGHA.2648@TK2MSFTNGP11.phx.gbl...
>>>>> OnStart happens before any request is in the pipeline.
>>>>>
>>>>> Personally, I'd stick a value in the web.config and read said value in
>>>>> BeginRequest.  if it's true, I'd simply Response.End there.
>>>>>
>>>>> Karl
>>>>>
>>>>> --
>>>>> http://www.openmymind.net/
>>>>>
>>>>>
>>>>>
>>>>> "GS" <n*@no.com> wrote in message
>>>>> news:unLTGQ8EGHA.2380@TK2MSFTNGP12.phx.gbl...
>>>>>> What would be the sample code to stop processing any further requests
>>>>>> in Application_onStart within global.asax has failed? Response.End
>>>>>> does not work since there is no response object at the point of
>>>>>> initializion.
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
8 Jan 2006 1:13 AM
Karl Seguin [MVP]
Store a value in the Application object in Start, and check it during
BeginRequest...not sure how else you'll be able to do it..

Karl

Show quote
"GS" <n*@no.com> wrote in message
news:%23pV95f%23EGHA.3064@TK2MSFTNGP10.phx.gbl...
> Yes,
>
> Thanks for all your help.
> The problem now is that BeginRequest is being executed for each new
> request coming in and I want to stop processing anything if stuff in
> Application_onStart was not initialized properly so BeginRequest is not
> really a choice here.
>
> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
> net> wrote in message news:ey0$hT9EGHA.1028@TK2MSFTNGP11.phx.gbl...
>> but you found it, right?
>>
>> Karl
>>
>> --
>> http://www.openmymind.net/
>>
>>
>>
>> "GS" <n*@no.com> wrote in message
>> news:%23wnJsn8EGHA.2912@tk2msftngp13.phx.gbl...
>>> Thanks,
>>>
>>> I use VS 2005 and it does not have this event when it created
>>> global.asax.
>>>
>>>
>>> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
>>> net> wrote in message news:%23MT4$l8EGHA.3920@TK2MSFTNGP09.phx.gbl...
>>>> Begin Request is an event of the Global.asax
>>>>
>>>> Karl
>>>>
>>>> --
>>>> http://www.openmymind.net/
>>>>
>>>>
>>>>
>>>> "GS" <n*@no.com> wrote in message
>>>> news:uh$ira8EGHA.868@TK2MSFTNGP10.phx.gbl...
>>>>> So how exactly I do that?
>>>>> I don't know which page will be access first so in which page
>>>>> "begin_request" event I need to put this in?
>>>>> Generally what is prefered way to handle application initialization
>>>>> failures in ASP.NET?
>>>>>
>>>>> G
>>>>>
>>>>>
>>>>> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO .
>>>>> ANDME net> wrote in message
>>>>> news:%23xUZdS8EGHA.2648@TK2MSFTNGP11.phx.gbl...
>>>>>> OnStart happens before any request is in the pipeline.
>>>>>>
>>>>>> Personally, I'd stick a value in the web.config and read said value
>>>>>> in BeginRequest.  if it's true, I'd simply Response.End there.
>>>>>>
>>>>>> Karl
>>>>>>
>>>>>> --
>>>>>> http://www.openmymind.net/
>>>>>>
>>>>>>
>>>>>>
>>>>>> "GS" <n*@no.com> wrote in message
>>>>>> news:unLTGQ8EGHA.2380@TK2MSFTNGP12.phx.gbl...
>>>>>>> What would be the sample code to stop processing any further
>>>>>>> requests in Application_onStart within global.asax has failed?
>>>>>>> Response.End does not work since there is no response object at the
>>>>>>> point of initializion.
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
7 Jan 2006 7:58 PM
Karl Seguin [MVP]
in 2.0 you can also use an App_Offline.htm file, take a look at:
http://weblogs.asp.net/eporter/archive/2005/10/05/426708.aspx

Karl

Show quote
"GS" <n*@no.com> wrote in message
news:unLTGQ8EGHA.2380@TK2MSFTNGP12.phx.gbl...
> What would be the sample code to stop processing any further requests in
> Application_onStart within global.asax has failed? Response.End does not
> work since there is no response object at the point of initializion.
>

AddThis Social Bookmark Button