ถ้าใช้ .net 2.0 เเล้วเจอ error ดังนี้ 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
มีวิธีเเก้คือ เพิ่ม "PostBackUrl = #"
ดังตัวอย่างนี้ครับ <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Search" PostBackUrl="#" />
Root Cause
This exception appears because Controls using DataKeyNames require Viewstate to be encrypted. When Viewstate is encrypted (Default mode, Auto, is to encrypt if controls require that, otherwise not), Page adds <input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" /> field just before closing of the <form> tag. But this hidden field might not have been rendered to the browser with long-running pages, and if you make a postback before it does, the browser initiates postback without this field (in form post collection). End result is that if this field is omitted on postback, the page doesn't know that Viewstate is encrypted and causes the aforementioned Exception. I.E. page expects to be fully-loaded before you make a postback.
Validation of viewstate MAC failed.
Moderator: mindphp, ผู้ดูแลกระดาน
- jataz2
- PHP Super Member
- โพสต์: 275
- ลงทะเบียนเมื่อ: 22/02/2011 11:48 am
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
-
โพสต์ใหม่ ช่วยด้วยครับ jtablesession::Store Failed DB function failed with error number 1146
โดย sattayayook » 02/08/2016 10:18 am » ใน Joomla Development - 1 ตอบกลับ
- 3484 แสดง
-
โพสต์ล่าสุด โดย mindphp
03/05/2017 3:37 am
-
-
-
โพสต์ใหม่ V & V - Verification & Validation คือ กระบวนการตรวจสอบและยืนยันความถูกต้องของระบบงาน
โดย M033 » 29/01/2016 2:06 pm » ใน Software testing - 0 ตอบกลับ
- 5714 แสดง
-
โพสต์ล่าสุด โดย M033
29/01/2016 2:06 pm
-
-
-
โพสต์ใหม่ การสร้าง Form Validation ในรูปแบบ alert
โดย abdkode » 10/01/2019 4:37 pm » ใน jQuery & Ajax Knowledge - 0 ตอบกลับ
- 2325 แสดง
-
โพสต์ล่าสุด โดย abdkode
10/01/2019 4:37 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 101