ถ้าใช้ .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.
Moderators: mindphp, ผู้ดูแลกระดาน
- jataz2
- PHP Super Member
- Posts: 254
- Joined: 22/02/2011 11:48 am
-
- Similar Topics
- Replies
- Views
- Last post
-
- 1 Replies
- 1287 Views
-
Last post by jataz2
10/03/2011 3:23 pm
-
- 1 Replies
- 2846 Views
-
Last post by sattayayook
01/08/2016 4:43 pm
-
-
ช่วยด้วยครับ jtablesession::Store Failed DB function failed with error number 1146
by sattayayook » 02/08/2016 10:18 am » in Joomla Development - 1 Replies
- 663 Views
-
Last post by mindphp
03/05/2017 3:37 am
-
-
- 1 Replies
- 3418 Views
-
Last post by fern2535
05/08/2015 11:31 am
-
-
V & V - Verification & Validation คือ กระบวนการตรวจสอบและยืนยันความถูกต้องของระบบงาน
by M033 » 29/01/2016 2:06 pm » in Software testing - 0 Replies
- 2922 Views
-
Last post by M033
29/01/2016 2:06 pm
-
-
-
การสร้าง Form Validation ในรูปแบบ alert
by abdkode » 10/01/2019 4:37 pm » in Jquery & Ajax Knowledge - 0 Replies
- 1408 Views
-
Last post by abdkode
10/01/2019 4:37 pm
-
-
-
TIP : การใช้ HTML5 Validation ตามรูปแบบที่กำหนด แทนการใช้ javascript
by M031 » 20/11/2015 1:34 pm » in PHP Knowledge - 1 Replies
- 1776 Views
-
Last post by konseo
20/11/2015 11:03 pm
-
Who is online
Users browsing this forum: Bing [Bot] and 3 guests