Click here to Skip to main content
15,844,013 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: problem When displaying barcode Pin
dapoussin9-Aug-06 1:59
dapoussin9-Aug-06 1:59 
QuestionPLz help me it is urgent Pin
Prasad.garlapati7-Aug-06 21:56
Prasad.garlapati7-Aug-06 21:56 
AnswerRe: PLz help me it is urgent Pin
_AK_7-Aug-06 22:01
_AK_7-Aug-06 22:01 
AnswerRe: PLz help me it is urgent Pin
albCode7-Aug-06 22:26
albCode7-Aug-06 22:26 
AnswerRe: PLz help me it is urgent Pin
PlayByTheRules8-Aug-06 2:42
PlayByTheRules8-Aug-06 2:42 
QuestionInvalid_Viewstate_Client_Disconnected Pin
Praveen_S7-Aug-06 21:52
Praveen_S7-Aug-06 21:52 
AnswerRe: Invalid_Viewstate_Client_Disconnected Pin
_AK_7-Aug-06 21:56
_AK_7-Aug-06 21:56 
GeneralRe: Invalid_Viewstate_Client_Disconnected Pin
Bimal Kothari2-Oct-08 4:56
Bimal Kothari2-Oct-08 4:56 
There are several conditions that may cause this issue. Each known condition is presented with a short explanation and a possible workaround.


1. Application Pool Recycling
2. Server Farms or Server Clusters
3. Form Posts
4. Proxy servers and Virus Scanners



Background:
Viewstate represents the state of the page when it was last processed on the server. The contents of the page are stored in a container and moved to and from the server on each request. By default, ASP.NET validates the contents of viewstate to ensure that it has not been tampered. If this validation test fails, an invalid viewstate exception is thrown. Some known issues that cause this test to fail are listed below.


Application Pool Recycling:
IIS 6 will periodically recycle the application pool to maintain the health of the application pool. At the instance when the application pool is being recycled, browser requests may sometimes result in an invalid viewstate error. The fix in this case is to adjust the settings on the application pools so that recycling is less likely to occur at peak periods. This issue represents a bug since the application pool is supposed to gracefully handle this condition.

Server Farms or Server Clusters:
Applications running in a server cluster must have all the machineKey configurations set to the same validationKey. The default autogenerate key cannot be used in a cluster environment. The registry keys responsible for autogeneration are listed here:

HKEY_LOCAL_MACHINE\Software\Microsoft\ASP.NET
HKEY_CURRENT_USER\Software\Microsoft\ASP.NET

When the machineKey is set to AutoGenerate, the key information is stored in the HKEY_CURRENT_USER hive for the account running the process. For W2k3 servers, this is the Network Service account. Otherwise, the account is ASP.NET machine account. When the process launches, ASP.NET will use the HKEY_CURRENT_USER registry key if it is available. If this key is not available, the
HKEY_LOCAL_MACHINE key will be used. If neither registry key exists, the process creates the key in the HKEY_LOCAL_MACHINE hive. If these conditions fail, the process creates a brand new set of keys.

When the application pool is running under a user account, the above keys are not generated leading to an intermittent invalid viewstate error.

The workaround is to use a specific key in the machine.config to prevent automatic key generation on each process start. The key must be exactly 128 bits made up of random characters and inserted into the configuration file on each webserver experiencing the problem.

Form Posts:
Viewstate can only be posted back to the same page. Attempting to post an aspx form to another page will fail with a viewstate invalid exception. This behavior is by design.

One other remedy involves disabling the Machine Authentication Check. Unless, you implement a back up authentication mechanism, you should refrain from this approach. Machine Authentication Checks are important in reducing the attack surface of ASP.NET applications.

Proxy servers and Virus Scanners:
A firewall and/or antivirus software can tamper with the viewstate resulting in an invalid viewstate exception being thrown.



Thanks,

Bimal Kothari

bimal.kothari@gmail.com
QuestionRead XML Pin
Vipin Venugopal7-Aug-06 21:35
Vipin Venugopal7-Aug-06 21:35 
AnswerRe: Read XML [modified] Pin
coolestCoder7-Aug-06 23:15
coolestCoder7-Aug-06 23:15 
Questionrefresh opner window Pin
mbbisht7-Aug-06 21:25
mbbisht7-Aug-06 21:25 
AnswerRe: refresh opner window Pin
Guffa7-Aug-06 21:41
Guffa7-Aug-06 21:41 
AnswerRe: refresh opner window [modified] Pin
Guffa8-Aug-06 9:09
Guffa8-Aug-06 9:09 
Questionphoto album prob (array to datalist , repeater)in image Pin
Pravin H7-Aug-06 20:31
Pravin H7-Aug-06 20:31 
QuestionshowModalDialog fires Page_Load only on first click Pin
Tarakeshwar Reddy7-Aug-06 20:15
professionalTarakeshwar Reddy7-Aug-06 20:15 
Questionlocal resources Pin
NasimKaziS7-Aug-06 20:06
NasimKaziS7-Aug-06 20:06 
Questionhandling keyboard event of data grid on client side Pin
24891287-Aug-06 19:43
24891287-Aug-06 19:43 
AnswerRe: handling keyboard event of data grid on client side Pin
Muhammad Chitrali7-Aug-06 23:46
Muhammad Chitrali7-Aug-06 23:46 
GeneralRe: handling keyboard event of data grid on client side Pin
24891288-Aug-06 2:32
24891288-Aug-06 2:32 
Questionhow to link menus with javascript in asp.net Pin
Ramu.e7-Aug-06 19:12
Ramu.e7-Aug-06 19:12 
QuestionECHO Pin
Tiger4567-Aug-06 18:48
Tiger4567-Aug-06 18:48 
QuestionHow to call/execute window application from web application ? Pin
lethanhtri7-Aug-06 18:20
lethanhtri7-Aug-06 18:20 
AnswerRe: How to call/execute window application from web application ? Pin
ravikiranreddydharmannagari7-Aug-06 19:46
ravikiranreddydharmannagari7-Aug-06 19:46 
GeneralRe: How to call/execute window application from web application ? Pin
Muhammad Chitrali7-Aug-06 23:51
Muhammad Chitrali7-Aug-06 23:51 
QuestionAdding Items To Cart Pin
kjosh7-Aug-06 16:50
kjosh7-Aug-06 16:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.