-
hi,
I am working on a web application which has a master page. Right now, on every page I am checking for session status(expired or not). And my appication has more than 30 pages. I want to know, should I check the session state on master page so that I don't have to write the code for session check on all the pages?
Regards,
Royal
-
Hi,
I do similar things, on my pages.
If you are not already using master pages, then i tend to subclass the page object, and then have all my pages inherit my base class.
This has several advantages, but the main one, is that if you sub class the page and then provide a session expired property, then you dont need to add a mastertype directive to each page.
However, if you are using masterpages and dont need to have access to whether the session has expired and just redirect to a login page, then masterpage is fine.
Regards
Si
-
hi Simon,
So what you recommend. Keeping in mind that I have a master page.
- Checking session on every content Page.
- Checking session only on master page.
- Or inherit a base class.
Regards
Royal
-
Hi again,
Checking the session on every page is obviously a bad design choice, as if the code is just being repeated without change, then it is pointing that it should be part of a base class.
Now if the page has a master page, then it is perfectly feasible to do it in there.
The only thing to be wary of, is i think the page page_load fires before the master page page_load event..
If you use a base class, you will need to set the base page load event and then mark it is overridable, and then override it in each page and call mybase.page_load etc.
tbh, i use a mixture of the two depending on what the site construction calls for.
Si
-
Thanks Simon
Regards,
Royal
Enter your message below
Sign in or Join us (it's free).