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
123
votes
7 answers

How can I take more control in ASP.NET?

I'm trying to build a very, very simple "micro-webapp" which I suspect will be of interest to a few Stack Overflow'rs if I ever get it done. I'm hosting it on my C# in Depth site, which is vanilla ASP.NET 3.5 (i.e. not MVC). The flow is very…
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
119
votes
6 answers

What is the difference between SessionState and ViewState?

What is the difference between SessionState and ViewState in ASP.NET?
Natrium
  • 30,772
  • 17
  • 59
  • 73
108
votes
7 answers

Invalid length for a Base-64 char array

As the title says, I am getting: Invalid length for a Base-64 char array. I have read about this problem on here and it seems that the suggestion is to store ViewState in SQL if it is large. I am using a wizard with a good deal of data…
Peter
  • 5,251
  • 16
  • 63
  • 98
95
votes
12 answers

What causing this "Invalid length for a Base-64 char array"

I have very little to go on here. I can't reproduce this locally, but when users get the error I get an automatic email exception notification: Invalid length for a Base-64 char array. at System.Convert.FromBase64String(String s) at…
Slim
  • 5,635
  • 7
  • 31
  • 30
75
votes
8 answers

Advantages of Cache vs Session

What is the difference between storing a datatable in Session vs Cache? What are the advantages and disadvantages? So, if it is a simple search page which returns result in a datatable and binds it to a gridview. If user 'a' searches and user 'b'…
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
63
votes
10 answers

Erratic Invalid Viewstate issue in a .NET application

I seem to be getting a "invalid viewstate" every now and then in the event viewer for my ASP.NET application. Most of them (95%) seem to be referencing ScriptResource.axd (the application uses the ASP.NET AJAX library). There is no way I can…
Martin
63
votes
11 answers

How to decode viewstate

I need to see the contents of the viewstate of an asp.net page. I looked for a viewstate decoder, found Fridz Onion's ViewState Decoder but it asks for the url of a page to get its viewstate. Since my viewstate is formed after a postback and comes…
Serhat Ozgel
  • 23,496
  • 29
  • 102
  • 138
57
votes
10 answers

Should I ignore the occasional Invalid viewstate error?

Every now and then (once every day or so) we're seeing the following types of errors in our logs for an ASP.NET 3.5 application Invalid viewstate Invalid postback or callback argument Are these something that "just happens" from time-to-time with…
Richard Ev
  • 52,939
  • 59
  • 191
  • 278
54
votes
13 answers

asp.net c# MVC: How do I live without ViewState?

I am just looking into converting WebForms to MVC: In .net MVC, what concepts make ViewState something thats not required? If a form is posted back on iteself etc (ie a postback)? how does the page/usercontrol maintain its state? What tricks are…
Mark Redman
  • 24,079
  • 20
  • 92
  • 147
50
votes
17 answers

Asp.net Validation of viewstate MAC failed

I am receiving the following error at certain times on asp.net website. Sys.WebForms.PageRequestManagerServerErrorException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that
Arbelac
  • 1,698
  • 6
  • 37
  • 90
42
votes
3 answers

ViewState Vs Session ... maintaining object through page lifecycle

Can someone please explain the difference between ViewState and Session? More specifically, I'd like to know the best way to keep an object available (continuously setting members through postbacks) throughout the lifecycle of my page. I currently…
Kyle
  • 10,839
  • 17
  • 53
  • 63
37
votes
2 answers

com.sun.faces.numberOfViewsInSession vs com.sun.faces.numberOfLogicalViews

Mojarra Implementation of JSF 2 has the following context params: com.sun.faces.numberOfViewsInSession (default is 15) com.sun.faces.numberOfLogicalViews (default is 15) What is the difference between them? The documentation doesn't speak much…
Miguel Ping
  • 18,082
  • 23
  • 88
  • 136
34
votes
1 answer

How does `onViewStateRestored` from Fragments work?

I am really confused with the internal state of a Fragment. I have an Activity holding only one Fragment at once and replaces it, if another Fragment should get shown. From the docs onSaveInstanceState is called ONLY if the Activitys…
Rafael T
  • 15,401
  • 15
  • 83
  • 144
32
votes
10 answers

ASP.NET CheckBox does not fire CheckedChanged event when unchecking

I have a CheckBox on an ASP.NET Content Form like so: In my code behind I have the following method: protected void…
Matt
  • 995
  • 1
  • 8
  • 18
31
votes
3 answers

How to get the value of built, encoded ViewState?

I need to grab the base64-encoded representation of the ViewState. Obviously, this would not be available until fairly late in the request lifecycle, which is OK. For example, if the output of the page includes:
Rex M
  • 142,167
  • 33
  • 283
  • 313
1
2 3
99 100