utilitaire
Regular
- Joined
- May 4, 2005
- Messages
- 77
Here's the problem:
I have a webform with many usercontrols. Those controls override the OnInit method, and the OnLoad method. The code runs fine, but I have some problem synchronizing all this. I have a certain routine I would like to execute each time a page is called by a client. This routine has to be done before ANY usercontrol is Init or Loaded. The question is: how do I do that? Where do I have to put the code in order to be sure It will be called before ANY other code? I tried in the «Init()» method of the main Page. It doesn't work since this «init» method is called after all controls in the page are called. Here's the scenario:
1) A client make a request.
2) The Page checks if the language in the URL (www.mysite.com/en/) is valid. My valid languages are "en" and "fr". If any other languages are specified, I redirect the client to a valid default language.
3) After the redirection, the new page (the good one) is executed, with all the controls in it. The «init» method is called for all controls, etc.
I want to make sure the step 2 is executed before step 3. I'm sure you faced this kind of problem. Any suggestion?
PS: Dont suggest me to do that in the global.asa, since the session_onstart method is only called once, and not each time the client make a new request for a page.
I have a webform with many usercontrols. Those controls override the OnInit method, and the OnLoad method. The code runs fine, but I have some problem synchronizing all this. I have a certain routine I would like to execute each time a page is called by a client. This routine has to be done before ANY usercontrol is Init or Loaded. The question is: how do I do that? Where do I have to put the code in order to be sure It will be called before ANY other code? I tried in the «Init()» method of the main Page. It doesn't work since this «init» method is called after all controls in the page are called. Here's the scenario:
1) A client make a request.
2) The Page checks if the language in the URL (www.mysite.com/en/) is valid. My valid languages are "en" and "fr". If any other languages are specified, I redirect the client to a valid default language.
3) After the redirection, the new page (the good one) is executed, with all the controls in it. The «init» method is called for all controls, etc.
I want to make sure the step 2 is executed before step 3. I'm sure you faced this kind of problem. Any suggestion?
PS: Dont suggest me to do that in the global.asa, since the session_onstart method is only called once, and not each time the client make a new request for a page.