Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I face this error when I click on button ,Linkbutton or datalist item command.
I change
C#
<page enableeventvalidation="false"></page>

in web config file.This erropr is reomved but now event does not occurs.
I serch on google.but my problem does not solve.Please help me.
the complete Error is
HTML
The state information is invalid for this page and might be corrupted. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
 
Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted.
 
Source Error: 
 

[No relevant source lines]
 
 
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\portal9161new\1f521660\5181c4db\App_Web_mryexrix.10.cs    Line: 0 
 
Stack Trace: 
 

[FormatException: Invalid character in a Base-64 string.]
   System.Convert.FromBase64String(String s) +0
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
   System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +57
 
[ViewStateException: Invalid viewstate. 
	Client IP: 127.0.0.1
	Port: 
	User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MSN Optimized;US)
	ViewState: /wEWFwLO08XUCALz3vPHCwKzrv6wAwK9vJ38DAKpi4ufBQKIgpWfBQLrmZefBQLKkICfBQK98JOfBQKc5/2WBQL//veWBQLe9YifBQLj4JT2BwLUk/WqAgKOkrn2CAKLkrn2CALCvJnnBAK//ZjtBwLNzIK2CALsjZ7JCALgutCTDwKLlba1BgLBzqW+BXf/jiRHAjSf0ntN+9hIlN0OfE3b,/wEWEQKIr8XKBALE5ML0AgLl97ftDQLb44SECwLb4+iFCwLR5JWQCwKBp/mABQL3meq7DgLqwoebCwL14vPbCQKe5MqPCQKNo6XnBAKe8IG6DAKipuWCDAK33sGJAQK33rWJAQLk97ftDfQ62Og2DDwFHqA1OfwvN70aZODt
	Referer: http://localhost:4424/Portal9161new/seatingplan.aspx
	Path: /Portal9161new/seatingplan.aspx]


one of the page code is
C#
<%@ Page Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true" CodeFile="seatingplan.aspx.cs" Inherits="seatingplan" Title="SeatingPlan" %>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ImageButton ID="ImageButton6" runat="server"  
            ImageUrl="~/Image/animated-globe2.gif"  width="36" border="0" height="24" />
      
    <asp:HyperLink ID="HyperLink8" runat="server"><font color="#000080" size="4">Seating 
plans</font>   
    <br />
    <span>
    <hr width="100%" /></span><br />

<div style="width:100%">        
<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" 
	RepeatColumns="4" BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" 
	 BorderWidth="1px" CellPadding="4" GridLines="Both" 
        onitemcommand="DataList1_ItemCommand" Width="100%" 
        style="font-size: x-small" >          
        <footerstyle backcolor="#FFFFCC" forecolor="#330099" />
        <itemstyle backcolor="White" forecolor="#330099" />
        <SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
        <itemtemplate>                 
          <asp:ImageButton ID="ImageButton1" runat="server" Height="120px" Width="196px" ImageUrl=' <%#Eval("url")%>' CommandName="select" CommandArgument='<%#Eval("url") %>' />
            <br />
             Head Line : <%#Eval("title") %> 
                  <br />
          </itemtemplate>
    
    <table align="center" width="100%" border="0">
<tr>
<td align="center"><asp:label id="lblCurrentPage" runat="server" CssClass="style51"></td>
</tr>
<tr>
<td align="center"><asp:button id="cmdPrev" runat="server" text=" << " onclick="cmdPrev_Click" 
        Width="65px">

     <asp:button id="cmdNext" runat="server" text=" >> " onclick="cmdNext_Click" 
        Width="65px"></td>
</tr>
</table>
   
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:cnn %>" 
        SelectCommand="SELECT [title],[url] FROM [seatplan]">
     
  
</div>    


<asp:Content ID="Content3" runat="server" 
    contentplaceholderid="ContentPlaceHolder2">
    <style type="text/css">
    .style51
    {
        color: black;
    }
</style>

error occured when i click on data list item
Posted
Updated 13-Oct-11 0:17am
v4
Comments
hitech_s 13-Oct-11 5:09am    
could you plz provide your design code?
uspatel 13-Oct-11 5:26am    
which design code,this error is on each page that have button,link button,datalist with datalist item command

1 solution

Try ViewStateEncryptionMode="Never" in page directive.
 
Share this answer
 
Comments
uspatel 13-Oct-11 6:42am    
I have tried this,but Error remains same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900