Managing state information in ASP.NET Application object?!

  • Thread starter Thread starter David Berman
  • Start date Start date
D

David Berman

Hello, I have a website, www.mysite.com. It has information populated
from a database on a per-city basis. I would like to make it so that if
you go to city.mysite.com, the city information provided is filtered to
include only the city specified. For example, boston.mysite.com will
provide a directory of venues in the city of Boston only.

I am able to capture the city by using regex functions. What I then
want to do is assign the city to the Session object, and use the session
object in Page_Load events to filter data in calls to the SQL server.
However, it seems that the session object does not exist in
Application_BeginRequest. What should I do? Should I stuff the city
information into a cookie first, and then have a template page check for
the cookie? Or, should I parse the URL looking for the specified city
in a different event?

Thank you for any advice!

David


Meet people for friendship, contacts,
or romance using free instant messaging software! See a picture you
like? Click once for a private conversation with that person!

www.SEN.us
 
Look into the application's Context.Items collection. This is an ideal
place to store options specific to a request and is available during
the life of the request.
 
Back
Top