views:

1384

answers:

2

I have a problem. While migrating from classic pipeline mode to integrated pipeline mode at IIS 7.0 we encounter the problem :

Server Error in '/' Application.

Request is not available in this context...

We found solution for this problem at mvolo.com/blogs/serverside/archive/2007/11/10/Integrated-mode-Request-is-not-available-in-this-context-in-Application_5F00_Start.aspx

As solution shortly ,in global.asax I must forward the application_start event to Application_BeginRequest event.

void Application_Start(object sender, EventArgs e) { // sender has type 'System.Web.HttpApplicationFactory' }

Application_BeginRequest(Object source, EventArgs e) | {

// sender has type 'System.Web.HttpApplication' }

Or another solution is, Application_Start event can start later then Application_BeginRequest .

any suggestions ? I have no option like choosing "classic mode "

A: 

So, change you app pool mode to classic.

leppie
this is not an option for me .
Yaya
A: 

Move the code to Application_BeginRequest or Session_Start. You shouldn't use the Request object in Application_Start anyway.

The Request object contains information that is specific for one page request. It doesn't really make any sense to do anything with this information in the Application_Start event.

Guffa
I have nothing with session or session_start . What i need is basically calling Application_BeginRequest event before application_start event or calling begin_request method from app_start with valid parameters..
Yaya
You can't change the order of the events, the application has to start before it can handle requests. Why do you need the Request object before there is a request?
Guffa