Questions tagged [viewstate]

ViewState is the mechanism that allows form field values to be preserved across page postbacks.

View state refers to the page-level state management mechanism utilized by component based frameworks, such as Microsoft and , Oracle and so on.

References

1589 questions
30
votes
3 answers

"Padding is Invalid and cannot be removed" exception on WebResource.axd

I have an ASP.NET 2.0 application that is working fine in our local environment. When published to a test server, we're getting intermittent errors on the server. Here's the most common: Padding is invalid and cannot be removed. Description: An…
Ben Scheirman
  • 40,531
  • 21
  • 102
  • 137
28
votes
5 answers

Is ViewState relevant in ASP.NET MVC?

I am learning ASP.NET MVC and many concepts of "ASP.NET" like authentication, authorization, session state still apply to it. But from whatever little I have understood, I don't see that ViewState is still relevant in an ASP.NET application. But it…
Hemant
  • 19,486
  • 24
  • 91
  • 127
25
votes
6 answers

In ASP.Net, during which page lifecycle event does viewstate get loaded?

I know it happens sometime before Load, but during what event exactly?
user9991
  • 576
  • 1
  • 5
  • 11
25
votes
12 answers

Does viewstate expire?

Let's say you have a aspx page that does not rely on session, but does rely on viewstate for persistance between postbacks. If a user is accessing this page, and leaves for a long lunch, will viewstate still be valid when he returns?
Aheho
  • 12,622
  • 13
  • 54
  • 83
22
votes
6 answers

User control (ascx) and properties

The only way I've found to persist property values within a user control is to use the ViewState. public string Title { get { return Convert.ToString(ViewState["Title"]); } set { ViewState["Title"] = value; } } I can't say I'm…
Jagd
  • 7,169
  • 22
  • 74
  • 107
19
votes
3 answers

asp.net viewstate encryption issue

I am attempting to turn on viewstate encryption Always as a security measure for my ASP.NET 3.5 website hosted in IIS6. We have viewstate turned off but still see some "controlstate" in this string. In a test environment I am able to simply set…
felickz
  • 4,292
  • 3
  • 33
  • 37
18
votes
9 answers

Invalid viewstate error

I'm getting an invalid viewstate error with regard to the ScriptResource.axd. Just wondering if anyone of you could help me on this. Error is: 2009-02-24 09:46:30,021 [13] DEBUG ASP.global_asax [(null)] - Request start - URL:…
Chamila
18
votes
1 answer

Minimizing viewstate- confused by `EnableViewState` and `ViewStateMode` in asp.net 4.0

I'm trying to clean up an older ASP.NET WebForms site that has ViewState enabled everywhere. This is a performance issue - huge viewstates cause noticeable submit delays. But most of the forms don't really seem to need ViewState except for some…
Jamie Treworgy
  • 23,934
  • 8
  • 76
  • 119
18
votes
3 answers

How to reduce javax.faces.ViewState in JSF

What is the best way to reduce the size of the viewstate hidden field in JSF? I have noticed that my view state is approximately 40k this goes down to the client and back to the server on every request and response espically coming to the server…
David Waters
  • 11,979
  • 7
  • 41
  • 76
17
votes
7 answers

ASP.NET MVC and ViewState

Now I've seen some questions like this, but it's not exactly what I want to ask, so for all those screaming duplicate, I apologize :). I've barely touched ASP.NET MVC but from what I understand there is no ViewState/ControlState... fine. So my…
nickytonline
  • 6,855
  • 6
  • 42
  • 76
16
votes
3 answers

Difference between viewbag and viewstate?

Is there a functional difference between ViewState in Webforms and ViewBag in MVC? They seem to be the "same thing". And can be used in the same ways. I ask because MVC promotes the stateless Web and not stuffing data in the page causing bloat and…
dotnetN00b
  • 5,021
  • 13
  • 62
  • 95
16
votes
4 answers

How to access viewstate using javascript?

I am trying to access view-state in client side but following exception coming : JAVASCRIPT: CODE BEHIND: Protected Sub…
Sukhjeevan
  • 3,074
  • 9
  • 46
  • 89
16
votes
3 answers

Uses for MachineKey in ASP.NET

What different ways are Machine Keys useful in asp.net? I think the following are correct but thought there may be more. Multiple applications can use the same cookie Multiple servers can work with the same viewstate
BenMaddox
  • 1,780
  • 3
  • 18
  • 30
16
votes
8 answers

Completely remove ViewState for specific pages

I have a site that features some pages which do not require any post-back functionality. They simply display static HTML and don't even have any associated code. However, since the Master Page has a
tag which wraps all…
Kerido
  • 2,930
  • 2
  • 21
  • 34
16
votes
2 answers

What is the equivalent of viewstate in ASP.net MVC

In asp.net pages, during postback, ViewState makes the data persistent. What makes the data persistent in ASP.net MVC?
RandomUser
  • 1,843
  • 8
  • 33
  • 65