Hi guys,

I have a site which requires 'setting up' on the first time the application is run (once per application rather than once per user). If the comapnyInformation table has no rows, then the initial user is redirected to a 'setup' page which populates the table. From then on, it will redirect to login page as normal because it knows the company is setup.

My question is this...

I have a method that checks that whether there is data present, and returns a boolean. Should this method be called in the page_load of all the pages, before checking user log in status, or should it go in global.asax (I'm guessing in the Session_Start)?

I'm still not very familiar with the global.asax file and when all the methods are actually called. (e.g. Is Application_Start run for every new instance of the site, ie for every user, or is it only once when IIS starts or what?).

As you gcan guess, I'm no expert yet.


Global.asax Application_Start is what you need. You want to use server side code in the server. You're absolutely correct with that idea of a small method looking for data. If there is no data or tables present, create it, or write back an error or redirect to your setup page.