Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 118329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:28:39+00:00 2026-05-11T03:28:39+00:00

I want to keep viewstate of a specific page in session but following code

  • 0

I want to keep viewstate of a specific page in session but following code block does not help me, what might I be missing?

So here is the code-behind file content of my page;

    public partial class ConfigurationEditorWebForm : PageBase     {         protected void Page_Load(object sender, EventArgs e)         {         }          protected override bool VerifyAccess()         {             return true;         }          protected override PageStatePersister PageStatePersister         {             get             {                 return new SessionPageStatePersister(this);             }         }     } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:28:40+00:00Added an answer on May 11, 2026 at 3:28 am

    Note that even after you move the page state to view state, you will still see a __Viewstate element on your pages.

    Also, I believe that this solution may be more correct than the others offered, as it handles the back button a bit more elegantly. When you store the ViewState in a hidden variable, it becomes part of the HTML, and is therefore available if the user clicks the back button 2 or 3 pages and continues with what he was doing. Blindly trashing the Viewstate with each page request will prevent the back button from behaving the way the user is expecting.

    However, it would be remiss to note that this is probably not a great idea in the first place. I would suggest doing at least two things first:

    First, make sure that you have turned off Viewstate on all of the controls that don’t need it (which will probably be most of them). You can do this by setting ‘IsViewstateEnabled’ to false.

    Second, turn on http compression on your webserver. Even if you have a reasonably sized viewstate, the total page weight (when compressed – not as viewed in your browser) should be relatively small.

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to keep only 1000 entries for each clientid. The code below does
I want to keep my footer at the bottom of the page while keeping
I have following classes. I want keep BP value unique across all items of
I want to keep-alive on each connection, but for only max 5 seconds. How
I want to keep the admin in english but the theme in another language.
I want to keep everything contained within a single function, and not make all
I want keep all my source code and documentation in one single Git repository.
I want to keep my line inside my circle. My code: Public Class Form1
I want to keep all of my JavaScript code in one section; just before
I want to keep the currency selector in top. So i added this code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.