472,143 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Access Virtual Directory with Application_OnStart

I've got a scenario with a web application where I must
access the virtual directory being accessed from within
the Application_OnStart event handler. Specifically, I
have a series of IIS virtual directories which all point
to the same set of ASP pages. However, since each virtual
directory is a separate 'application', each has its own
set data which must be cached. To detect which data must
be cached for each virtual directory, I need to detect the
name of the virtual directoy being invoked from within the
Application_OnStart event.

The problem is that the Request.ServerVariables collection
is not avaiable within the Application_OnStart event
handler. Is there a workaround for this?

Thanks,
Mark
Jul 19 '05 #1
4 3637
CJM
This sounds liek a complicated design... can you give some background? There
may be an alternative design that avoids this problem...

CJM

"Mark Hoagland" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
I've got a scenario with a web application where I must
access the virtual directory being accessed from within
the Application_OnStart event handler. Specifically, I
have a series of IIS virtual directories which all point
to the same set of ASP pages. However, since each virtual
directory is a separate 'application', each has its own
set data which must be cached. To detect which data must
be cached for each virtual directory, I need to detect the
name of the virtual directoy being invoked from within the
Application_OnStart event.

The problem is that the Request.ServerVariables collection
is not avaiable within the Application_OnStart event
handler. Is there a workaround for this?

Thanks,
Mark

Jul 19 '05 #2
put your init code into session_onstart
use an app var as a flag to skip the init code if a particular virtual dir
has already been initialized.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Mark Hoagland" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
I've got a scenario with a web application where I must
access the virtual directory being accessed from within
the Application_OnStart event handler. Specifically, I
have a series of IIS virtual directories which all point
to the same set of ASP pages. However, since each virtual
directory is a separate 'application', each has its own
set data which must be cached. To detect which data must
be cached for each virtual directory, I need to detect the
name of the virtual directoy being invoked from within the
Application_OnStart event.

The problem is that the Request.ServerVariables collection
is not avaiable within the Application_OnStart event
handler. Is there a workaround for this?

Thanks,
Mark

Jul 19 '05 #3
Session_OnStart is not a viable alternative because we
have session state disabled on all virtual directories.
We've found that enabling session state decreases the
scalability of our application by 25-40%, so we always
disable session state.

As for the overall design of the application, it is a
massive ASP based application with about 2500 pages for
managing customer interactions. The reason that we must
have multiple virtual directories pointing to the same
code base is that I work for a hosting company, so we have
multiple customers on the same application. The trick is
that the application is based upon a packaged, enterprise
software application so we must upgrade our modified
version of the product periodically and to minimize the
overall maintenance and upgrade effort we keep all of our
customers on a single code base. We initially started out
with each virtual directory pointing to a separate copy of
the code, but found that propagating changes to the
servers would take 10+ hours. Plus, the overall effort to
manage that many 'sets' of code was going to force us to
hire at least one additional programmer.

-----Original Message-----
put your init code into session_onstart
use an app var as a flag to skip the init code if a particular virtual dirhas already been initialized.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Mark Hoagland" <an*******@discussions.microsoft.com> wrote in messagenews:05****************************@phx.gbl...
I've got a scenario with a web application where I must
access the virtual directory being accessed from within
the Application_OnStart event handler. Specifically, I
have a series of IIS virtual directories which all point
to the same set of ASP pages. However, since each virtual directory is a separate 'application', each has its own
set data which must be cached. To detect which data must
be cached for each virtual directory, I need to detect the name of the virtual directoy being invoked from within the Application_OnStart event.

The problem is that the Request.ServerVariables collection is not avaiable within the Application_OnStart event
handler. Is there a workaround for this?

Thanks,
Mark

.

Jul 19 '05 #4
sounds like you are between the ol' rock and hard place.

Do users always enter the application through the same ASP page (default.asp
for instance)?
If so, add the initialization code to that page. Check for a specific app
var to avoid re-initialization.

Another option would be to set up a manual initialization page that you
could call directly after the web-server is re-started to load the
application vars. Then call it via each valid path (this would be
problematic if your server does unattended restarts).

Yet another option would be to add an include file to each page that a user
might enter the app with. You might be able to do something like this with a
global search/replace utility.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Mark Hoagland" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Session_OnStart is not a viable alternative because we
have session state disabled on all virtual directories.
We've found that enabling session state decreases the
scalability of our application by 25-40%, so we always
disable session state.

As for the overall design of the application, it is a
massive ASP based application with about 2500 pages for
managing customer interactions. The reason that we must
have multiple virtual directories pointing to the same
code base is that I work for a hosting company, so we have
multiple customers on the same application. The trick is
that the application is based upon a packaged, enterprise
software application so we must upgrade our modified
version of the product periodically and to minimize the
overall maintenance and upgrade effort we keep all of our
customers on a single code base. We initially started out
with each virtual directory pointing to a separate copy of
the code, but found that propagating changes to the
servers would take 10+ hours. Plus, the overall effort to
manage that many 'sets' of code was going to force us to
hire at least one additional programmer.

-----Original Message-----
put your init code into session_onstart
use an app var as a flag to skip the init code if a

particular virtual dir
has already been initialized.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Mark Hoagland" <an*******@discussions.microsoft.com>

wrote in message
news:05****************************@phx.gbl...
I've got a scenario with a web application where I must
access the virtual directory being accessed from within
the Application_OnStart event handler. Specifically, I
have a series of IIS virtual directories which all point
to the same set of ASP pages. However, since each virtual directory is a separate 'application', each has its own
set data which must be cached. To detect which data must
be cached for each virtual directory, I need to detect the name of the virtual directoy being invoked from within the Application_OnStart event.

The problem is that the Request.ServerVariables collection is not avaiable within the Application_OnStart event
handler. Is there a workaround for this?

Thanks,
Mark

.

Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Edward W. | last post: by
4 posts views Thread by Martin | last post: by
reply views Thread by Yogesh Pancholi | last post: by
3 posts views Thread by David Thielen | last post: by
7 posts views Thread by Fred | last post: by

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.