悪名高いエラーが発生しています
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
広範な検索を行った後、特定の問題を解決するものは見つかりません。.NET 4 で URL ルーティングを使用していますが、MVC は使用していません。(URL ルーティングによる) 私が見つけた類似の問題/解決策はすべて MVC で解決策を提供しますが、通常の ASP.NET Web フォームでは解決策を提供しません。
ここのスタック オーバーフローの質問には、次のように記載されています。
URLのサブパスの数に関連しているようです。サブパスが 2 つ以上ある場合、viewstate の検証は失敗します。
この理論をテストする際に、ルートを変更するだけで、迅速で汚い回避策を提供することができました
Module/Search/Results
に
Module/SearchResults
問題は一時的に解決されましたが、その投稿の回答はまったく役に立ちませんでした。
興味深いことに、エラーは IE9 で再現できますが、Chrome 24.0.1313.52m では再現できません。これにより、このエラーはブラウザー固有のものであると思われるため、サイトに NoCache を設定しようとしましたが、Chrome は引き続き機能し、IE9 は引き続き ViewState エラーをスローしました。
問題を再現するために、私の環境の重要な要素をいくつか示します。
Windows 7 64-bit
IIS 6.1 SP 1
Local Web Project (VS 2010)
Nested Master Pages (3 levels)
URL Routing (defined in Global.asax)
Page contains a GridView with a TemplateField.
GridView has PagerSettings defined.
Links causing the error are within the TemplateField.
Links outside of the GridView do not cause the error.
再現する手順は次のとおりです。
User browses to page "~/Module/Search/Results" (from link or directly doesn't matter)
User clicks on a button that posts back and causes a redirect to another page "~/Module/DoSomething"
User presses the Back button in the browser which takes them back to "~/Module/Search/Results"
User then proceeds to press a button that causes a post-back which immediately causes the error.
更新: ページのレイアウトに関する重要な要素に情報を追加しました。
ユーザーがページに戻って別のポストバックを生成したときにエラーを発生させずに、Web ページの URL に 2 つ以上のサブパスを含めることができるように、すべてのブラウザーでこの問題を解決するにはどうすればよいですか?