Question

Once I click the button, it throws a "Validation of viewstate MAC failed" exception. I know MVC does not support PostBack but is there any way to work around this?

Or we need to use HtmlHelper in MVC?

Below is my code in View:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<form id="form1" runat="server">

<h2>Hello World</h2>

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<br />

<asp:Button ID="Button1" runat="server" Text="Button" />

</form>

</asp:Content>
Was it helpful?

Solution

Don't fight your framework - if you want to use ASP.NET MVC, then go ahead and use it but create controls using the tools of the framework.

If you want or need to use postback controls then you really ought to stick with regular old ASP.NET.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top