As was suggested before putting the method on the main page seems to work.
If you want to be able to call on all pages then put the method in a base page class.
Post is a bit old but in case others are still having problems (doesn't seem to be any different in VS 2008/3.5 framework).
Also had similar problems but only with Master Page or user controls.
Should look something like: I recently had problems with this.