Does anyone know how to grab the current Session, or Viewstate from within a public static method? I've got some WebMethods and I'd like to get the page context once inside of the server-side method.
Thanks,
Mark
You can access the Session, but not the ViewState.
Inside a static method, you need to reference the Session like so: HttpContext.Current.Session
You can also pass EnableSession=true to the WebMethod attribute, but honestly I'd strongly recommend just sending the values up the pipe if at all possible (as params).
No comments:
Post a Comment