Welcome Guest Search | Active Topics | Sign In | Register

A comma in the ViewState string !!?? Options
Phil
Posted: Wednesday, August 29, 2007 4:25:34 AM
Rank: Newbie
Groups: Member

Joined: 8/29/2007
Posts: 3
I create an application which uses eoTreeView, eoCallBackPanel, aspMultiView, aspPageView, and an user control using aspDataList.
Il worked very well until I associate the TreeView whith the CallBackPanel. It give me a server error : "The state information is invalid for this page and might be corrupted."

See what : The ViewState string is like this :

ViewState: /wEWCALZ9K+aAgKMi5/UCgKyt/y7AwKTiJrzBALrg
YnUCgL3hLS5AwKWgJrzBAL269r4CdzyPyJzS577QgcZFkim1CH9KJxk,
/wEWCwLRrMGzDAKMi5/UCgKyt/y7AwKTiJrzBALrgYnUCgL3h
LS5AwKWgJrzBALum5TUCgKk5KW/AwKNuJrzBAL269r4CWi70jWHfVUk8bJkFPqDdRGlxneG

There is a comma in the ViewState string which separate 2 valid BASE-64 data.

I've wrote a small example to reproduce this error. (where can I upload or email to you?) Please give me a suggestion to prevent this problem. Thank you!

Phil
Posted: Wednesday, August 29, 2007 4:35:37 AM
Rank: Newbie
Groups: Member

Joined: 8/29/2007
Posts: 3
Default.aspx
Code: HTML/ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Src="MyDataList.ascx" TagName="MyDataList" TagPrefix="uc1" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table border="0">
                <td valign="top">
                    <eo:TreeView ID="eoTreeView" runat="server" ControlSkinID="None" Height="250px" Width="200px">
                        <LookNodes>
                            <eo:TreeNode CollapsedImageUrl="00030301" DisabledStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:Gray;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;"
                                ExpandedImageUrl="00030302" ImageUrl="00030301" ItemID="_Default" NormalStyle-CssText="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; COLOR: black; BORDER-TOP-STYLE: none; PADDING-TOP: 1px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; BORDER-BOTTOM-STYLE: none"
                                SelectedStyle-CssText="background-color:#316ac5;border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:White;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;">
                            </eo:TreeNode>
                        </LookNodes>
                        <TopGroup Style-CssText="border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;">
                            <Nodes>
                                <eo:TreeNode ImageUrl="00030303" RaisesServerEvent="True" Text="Desktop">
                                </eo:TreeNode>
                                <eo:TreeNode ImageUrl="00030305" RaisesServerEvent="True" Text="My Computer">
                                </eo:TreeNode>
                                <eo:TreeNode ImageUrl="00030304" RaisesServerEvent="True" Text="My Documents">
                                </eo:TreeNode>
                            </Nodes>
                        </TopGroup>
                    </eo:TreeView>
                </td>
                <td valign="top">
                    <eo:CallbackPanel ID="eoCallbackPanel" runat="server" Triggers="{ControlID:eoTreeView;Parameter:},{ControlID:ucMyDataList;Parameter:}">
                        <asp:MultiView ID="msMultiView" runat="server">
                            <asp:View ID="msView1" runat="server">
                                <uc1:MyDataList ID="ucMyDataList" runat="server" />
                            </asp:View>
                        </asp:MultiView>
                    </eo:CallbackPanel>
                </td>
            </table>
        </div>
    </form>
</body>
</html>


Default.aspx.vb
Code: Visual Basic.NET
Imports System.Collections.Generic

Partial Class _Default
    Inherits System.Web.UI.Page


    Protected Sub eoTreeView_ItemClick(ByVal sender As Object, ByVal e As EO.Web.NavigationItemEventArgs) Handles eoTreeView.ItemClick
        Select Case e.TreeNode.Text
            Case "Desktop"
                msMultiView.SetActiveView(msView1)
            Case Else
                msMultiView.ActiveViewIndex = -1
        End Select
    End Sub
End Class


MyDataList.ascx
Code: HTML/ASPX
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="MyDataList.ascx.vb" Inherits="MyDataList" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<eo:CallbackPanel ID="eoCallbackPanel" runat="server" Height="150px" Triggers="{ControlID:msButtonCreer;Parameter:},{ControlID:msList;Parameter:}"
    Width="200px">
<asp:DataList ID="msList" runat="server" CellPadding="4" ForeColor="#333333" Height="56px" Width="248px" ShowFooter="False" ShowHeader="False">
    <ItemTemplate>
        <asp:Label ID="msLabelNom" runat="server"></asp:Label>
        <br />
        <asp:Button ID="msButtonSelect" runat="server" CommandName="select" Text="Select" />
        <asp:Button ID="msButtonModifier" runat="server" CommandName="edit" Text="Modifier" />
        <asp:Button ID="Button1" runat="server" CommandName="xYz" Text="XYZ" /> 
    </ItemTemplate>
    <EditItemTemplate>
        Nom :
        <asp:TextBox ID="msTextNom" runat="server"></asp:TextBox><br />
        Prénom :
        <asp:TextBox ID="msTextPrenom" runat="server"></asp:TextBox><br />
        <asp:Button ID="msButtonOK" runat="server" CommandName="update" Text="OK" />
        <asp:Button ID="msBoutonAnnuler" runat="server" CommandName="cancel" Text="Annuler" />
        <asp:Button ID="msBoutonXyz" runat="server" CommandName="XyZ" Text="XYZ" /> 
    </EditItemTemplate>
    <SelectedItemTemplate>
        Nom :
        <asp:Label ID="msLabelNom" runat="server" Text="Label"></asp:Label><br />
        Prénom :
        <asp:Label ID="msLabelPrenom" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:Button ID="msButtonModifier" runat="server" CommandName="edit" Text="Modifier" /> 
    </SelectedItemTemplate>
    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <SelectedItemStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
    <AlternatingItemStyle BackColor="White" />
    <ItemStyle BackColor="#E3EAEB" />
    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
</asp:DataList>
<asp:Button ID="msButtonCreer" runat="server" Text="Créer" /></eo:CallbackPanel>


MyDataList.ascx.vb
Code: Visual Basic.NET
Imports System.Collections.Generic

Partial Class MyDataList
    Inherits System.Web.UI.UserControl

    Private liste As List(Of Personnel)

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then
            liste = DirectCast(Session("Liste"), List(Of Personnel))
        Else
            liste = New List(Of Personnel)
            liste.Add(New Personnel("WU", "Yu-Fu"))
            liste.Add(New Personnel("DOCQUIER", "Laurant"))
            Session("Liste") = liste

            BindDataSource()
        End If
    End Sub

    Protected Sub msList_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles msList.CancelCommand
        msList.EditItemIndex = -1
        BindDataSource()
    End Sub

    Protected Sub msList_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles msList.EditCommand
        msList.EditItemIndex = e.Item.ItemIndex
        msList.SelectedIndex = -1
        BindDataSource()
    End Sub

    Protected Sub msList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles msList.ItemCommand
        System.Diagnostics.Debug.WriteLine("CommandName=" & e.CommandName)
    End Sub

    Protected Sub msList_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles msList.ItemDataBound
        Dim p As Personnel = DirectCast(e.Item.DataItem, Personnel)

        Select Case e.Item.ItemType
            Case ListItemType.Item, ListItemType.AlternatingItem
                DirectCast(e.Item.FindControl("msLabelNom"), Label).Text = p.ToString
            Case ListItemType.SelectedItem
                DirectCast(e.Item.FindControl("msLabelNom"), Label).Text = p.nomValue
                DirectCast(e.Item.FindControl("msLabelPrenom"), Label).Text = p.prenomValue
            Case ListItemType.EditItem
                DirectCast(e.Item.FindControl("msTextNom"), TextBox).Text = p.nomValue
                DirectCast(e.Item.FindControl("msTextPrenom"), TextBox).Text = p.prenomValue
        End Select
    End Sub

    Protected Sub msList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles msList.SelectedIndexChanged
        BindDataSource()
    End Sub

    Protected Sub msButtonCreer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles msButtonCreer.Click
        liste.Add(New Personnel())
        BindDataSource()
    End Sub

    Protected Sub msList_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles msList.UpdateCommand
        Dim txtNom As TextBox = DirectCast(e.Item.FindControl("msTextNom"), TextBox)
        Dim txtPrenom As TextBox = DirectCast(e.Item.FindControl("msTextPrenom"), TextBox)

        Dim p As Personnel = liste(e.Item.ItemIndex)
        p.nomValue = txtNom.Text
        p.prenomValue = txtPrenom.Text

        msList.EditItemIndex = -1
        BindDataSource()
    End Sub

    Private Sub BindDataSource()
        msList.DataSource = liste
        msList.DataBind()
    End Sub
End Class


App_Code\Personnel.vb
Code: Visual Basic.NET
Imports Microsoft.VisualBasic

Public Class Personnel
    Public nomValue As String
    Public prenomValue As String

    Public Sub New()
        nomValue = String.Empty
        prenomValue = String.Empty
    End Sub

    Public Sub New(ByVal nom As String, ByVal prenom As String)
        nomValue = nom
        prenomValue = prenom
    End Sub

    Public Overrides Function ToString() As String
        Return nomValue.ToUpper & " " & prenomValue
    End Function
End Class
Phil
Posted: Wednesday, August 29, 2007 4:39:21 AM
Rank: Newbie
Groups: Member

Joined: 8/29/2007
Posts: 3
Pre-notice

1. Environment : Visual Basic in Visual Studio Pro 2005 SP1

2. Please copy your file EO.Web.dll to the "Bin" directory before running this program.


Steps to reproduce the error

1. Run the program.

2. Click "Desktop" in the TreeView

3. Click the bouton "Creer".

4. Click the bouton "Creer" again, and you'll see the error message.

You'll find there is a "comma" in the ViewState string to separate 2 valid ViewState strings.

And the error messages are :

Code:
Server Error in '/WebSite' Application.
--------------------------------------------------------------------------------

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.

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() +172

[ViewStateException: Invalid viewstate.
    Client IP: 127.0.0.1
    Port:
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; InfoPath.1)
    ViewState: /wEWCALZ9K+aAgKMi5/UCgKyt/y7AwKTiJrzBALrgYnUCgL3h
LS5AwKWgJrzBAL269r4CdzyPyJzS577QgcZFkim1CH9KJxk,
/wEWCwLRrMGzDAKMi5/UCgKyt/y7AwKTiJrzBALrgYnUCgL3hLS5AwKWgJrzBAL
um5TUCgKk5KW/AwKNuJrzBAL269r4CWi70jWHfVUk8bJkFPqDdRGlxneG
    Referer: http://localhost:1738/WebSite/
    Path: /WebSite/default.aspx]

[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
   System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +116
   System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +209
   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +67
   System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +106
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +32
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
   System.Web.UI.Page.ProcessRequest() +86
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.default_aspx.ProcessRequest(HttpContext context) +29
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
eo_support
Posted: Wednesday, August 29, 2007 7:18:04 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Thanks for the detailed information. We have reproduced the error and we are digging into right now. We will post update you as soon as we find anything.

Thanks
eo_support
Posted: Wednesday, August 29, 2007 10:31:15 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We have identified and fixed the issue. Please see your private message for download location of the patched build.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.