With String accountName = this.Context.Request.QueryString["accountname"].ToString(); im getting the needed value for the filter webpart on my ListWebPart.

If im paging my List, the url changes and i can't query my url string anymore with that my filter crashes and i receive an exception.

Is there a way to persist my "accountname" from the querry string to use it through out the paging?


If you are only using your own "accountname", you might be better-off using SPContext.Current.Web.CurrentUser instead.

Otherwise, if "accountname" could be any account (not only yours), you could store it in a session variable, but if your SharePoint is running on a web farm, and you bounce to a different server (load-balancing), your session will be empty (unless your admin is using an external "session state server"). It isn't likely to happen very often, but it could irritate your users. You might want to check on that.

| improve this answer | |
  • I want to get the user profile of the page which user is currently displayed, so CurrentUser won't work for me. Do you know another way to get the object of the currently displayed user? I will look into the session variables.. thanks so far! – Peter Jul 25 '13 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.