Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster



  <pages viewStateEncryptionMode="Always" />

Calling Content Page Method from MasterPage Method

You can do this using Delegates.

For Example, you have a button in MasterPage and you want to call a Method in Content Page from Master Page. Here is the Code in Master Page.

Master Page:

public partial class MasterPage : System.Web.UI.MasterPage
    protected void Page_Load(object sender, EventArgs e)

    protected void Button1_Click(object sender, EventArgs e)
        if (contentCallEvent != null)
            contentCallEvent(this, EventArgs.Empty);
    public event EventHandler contentCallEvent;

Content Page:

public partial class Content_1 : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    private void Master_ButtonClick(object sender, EventArgs e)
        // This Method will be Called.
    protected void Page_PreInit(object sender, EventArgs e)
        // Create an event handler for the master page's contentCallEvent event
        Master.contentCallEvent += new EventHandler(Master_ButtonClick);

And Also add the Below Line Specifying you MasterPage Path in VirtualPath

<%@ MasterType VirtualPath="~/MasterPage.master" %> 
// This is Strongly Typed Reference

how to disable previous dates in CalendarExtender control through its render event?

head runat="server">
    <title>Calendar Extender</title>
    <script type="text/javascript">
    function checkDate(sender,args)
 if (sender._selectedDate < new Date())
                alert("You cannot select a day earlier than today!");
                sender._selectedDate = new Date(); 
                // set the date back to the current date

Call the code:

<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />

            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <cc1:CalendarExtender ID="CalendarExtender1"
            runat="server" OnClientDateSelectionChanged="checkDate" TargetControlID="TextBox1" />