I need to be able to tell from within a VB.NET class (not a user control) whether or not the current request is a PostBack and/or CallBack (AJAX). In the past I’ve been able to get information about the request, response, session, etc through HttpContext.Current but I haven’t been able to find the Page object in HttpContext.Current.
Is this possible?
HttpContext.Current.Handler will return a System.Web.IHandler, which may happen to be a System.Web.UI.Page. Use the as operator to cast it to a Page, and be sure to check whether it’s null before using it.