Asp.net uses the POST method action to go to another page and accepts the form value on another page! (Error reported, resolved !)

Source: Internet
Author: User

I want to use post to upload the value of a page form to another page. When I click default. when the send and submit button of aspx is used, the default2.aspx page is displayed. At this time, an error is reported, and the error message is 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 (I don't understand why it is like this !)

Solution: Add <% @ page Language = "C #" enableviewstatemac = "false" %> to default2.aspx on the page to be accepted!

Default. aspx pageCode:

<Form ID = "form1" method = "Post" Action = "default2.aspx" runat = "server"> <div> your name <asp: textbox id = "name" runat = "server"> </ASP: textbox> <br/> <input type = "Submit" value = "send"/> <br/> learn how to use request and response <br /> <br/> </div> </form>

Default2.aspx Page code:

    String  Name  =  Request [  "  Name  " ];
Response. Write (name + " <Br> " );
Response. Write ( " You are using " + Request. requesttype + " Transmission data " );

Only code for accepting Form values is added to page_load!

Related Article

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.