Mvc1.0 Development Summary 1: reason for validation of viewstate Mac failed Error

Source: Internet
Author: User

It seems that after a busy period of time, I had a short rest. I really miss the time last year, after finishing the task assigned by the head, I began to look at my favorite technologies.ArticleAnd do some exercises,
I feel that I have learned many things every day. Now I am responsible for some projects and want to understand the requirements. , Design EDM , As small JS, CSS Nothing can be left behind. My colleagues used to work on moss,
Many things require me to make a sample and let them do it in imitation, for the progress Even if you often work overtime until or later, you still have to finish the work. .

At the beginning of the project, Discussing the framework used, Me Cast Mvc.net One vote, I want to continue with it. When I learned that this project was under my responsibility, I suddenly felt
Body Pressure There are not many functional modules, but there are 10 types of roles, so the logic is still very complicated. I am not very worried about modeling. My previous experiences have made me very confident in modeling.
MVC. net1.0Only released 1 Around a week, except for those articles on the MS official website, few resources were seen, because there were too many preview versions, and each version had some improvements,
But I don't know the differences between those versions and RTM. My side View requirement document , While designing models , Coming off work Do Some MVCOf Exercise , When the framework is set up,
When I started adding the feature, I did not expect an error from the beginning, which left me helpless. An exception occurred when the view Form Verification Failed,  Validation of viewstate Mac failed Error

GoogleThe issue is rarely found in MVC applications, but there are many such errors in traditional web programs, as they say 1, 2, 3 .. and try them one by one.
This made me very strange. I found some open source code on codeplex and found out why it still does not seem to have been found. Going home at night, I kept trying to search for different keywords on Google.com and finally saw a positive solution.

Http://www.dotneat.net/2008/12/13/ASPNETMVCValidationOfViewstateMACFailedError.aspx

If you get Validation of viewstate Mac failed Error on ASP. NET MVC , Before trying to hard code your <machinekey attribute in Web. config,
Disabling the keying of viewstate

<System. Web>
<Pages enableviewstatemac = "False" />
</System. Web>

, Or Any other literature You may want to check if the page you are posting data from Has two "<form" attributes  
(The one hard coded on the page and the one created with HTML. beginform) If you play with Master templates and have
To merge some MVC pages with Tradicional ASP. NET you may get to that error. Obviously, this section in webconfig is useless. <System. Web>
<Pages enableviewstatemac = "False" />
</System. Web>

Any other literature You may want to check if the page you are posting data from Has two "<form" attributes
(The one hard coded on the page and the one created with HTML. beginform ()). if you play with Master templates and have to merge some MVC pages with Tradicional ASP. net you may get to that error.

This is the main reason why two forms mark nesting. If the form label is retained on the template page, use Html. beginform ()) It is equivalent to nesting two form labels,
When the verification fails, because the Asp.net server-side control is not used and there is no viewstate Validation of viewstate Mac failed Error   Therefore, you only need to set the Template
If the form label is removed, it will be normal. Let's look back at the demo'sCodeThis is the case. It's strange that you don't look at things carefully when learning.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.