Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net VB.net error with Mac Book

Hi

I am getting the following problem only on Mac Books
When users click on the buttons in a Gridview on my ASP.net web form
I have the VB.net code    Private Sub GridView2_RowCommand1 at the bottom
that handles the button clicks

I am getting the error

Server Error in '/' Application.
--------------------------------------------------------------------------------


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.
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: 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.

Source Error:


The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

 1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

   <%@ Page Language="C#" Debug="true" %>

 or:

 2) Add the following section to the configuration file of your application:

 <configuration>
    <system.web>
        <compilation debug="true"/>
    </system.web>
 </configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

 Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[ViewStateException: Invalid viewstate.
      Client IP: 41.189.95.40
      Port: 2629
      Referer: http://www.webexcel.co/Questions.aspx
      Path: /Questions.aspx
      User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0
      ViewState: /wEPDwULLTE0NTQxMDQ2NzEPZBYCZg9kFgICAw9kFgYCAQ8PFgYeCUZvcmVDb2xvcgo7HgRfIVNCAgQeB1Zpc2libGVnFgIeBXN0eWxlBRBmb250LXNpemU6TGFyZ2U7ZAIDDw8WCB4GSGVpZ2h0GwAAAAAAAF5AAQAAAB4ISW1hZ2VVcmwFHX4vUmVzb3VyY2VzL0xvZ29fSnVwaXRlcjEuanBnHgVXaWR0aBsAAAAAAABeQAEAAAAfAQKAA2RkAgcPZBYiAgEPDxYCHwUFHH4vUmVzb3VyY2VzL0dSRUFUX0hlYWRlci5qcGdkZAIDDw8WAh4EVGV4dAUxeW91IGFyZSBsb2dnZWQgaW4gdW5kZXIgZW1haWwgdG1pY2hpZUBqdXBpdGVyLmNvbWRkAgUPDxYCHwcFCkxvZ2dlZCBpbjpkZAIHDw8WAh8HBRN0bWljaGllQGp1cGl0ZXIuY29tZGQCCQ8PFgIfBwUDSlVQZGQCCw8PFgIfB2VkZAIXDw8WAh8HBUxQbGVhc2Ugc2Nyb2xsIGRvd24gJiBjb21wbGV0ZSB0aGUgc3VydmV5IHF1ZXN0aW9ucyBiZWxvdy4gVGhlbiBjbGljayAnRG9uZScuZGQCIQ8PFgIfBwUBMWRkAiMPDxYCHwdlZGQCJQ9kFggCAQ88KwARAwAPFgYeC18hRGF0YUJvdW5kZx4LXyFJdGVtQ291bnQCHh8CZ2QBEBYAFgAWAAwUKwADFggeBE5hbWUFBk51bWJlch4KSXNSZWFkT25seWgeBFR5cGUZKwEeCUR...]

[HttpException (0x80004005): 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.]
   System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +198
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +432
   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Deserialize(String serializedState, Purpose purpose) +8
   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) +40
   System.Web.UI.HiddenFieldPageStatePersister.Load() +248
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +88
   System.Web.UI.Page.LoadAllState() +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6704
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245
   System.Web.UI.Page.ProcessRequest() +72
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +58
   ASP.questions_aspx.ProcessRequest(HttpContext context) +37
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69


<asp:GridView ID="GridView_Questions" runat="server" BackColor="White"
                BorderColor="#3366CC" BorderStyle="Solid" BorderWidth="1px" CellPadding="4"
                Height="147px" Visible="False" Width="795px">
                <Columns>

                      <asp:TemplateField HeaderText="Strongly Agree" HeaderStyle-Font-Size ="Small"
                                            ControlStyle-Font-Bold ="false" ControlStyle-Forecolor ="#006600"
                                            ControlStyle-Font-Size ="Smaller">
                    <ItemTemplate>
                        <asp:Button ID="Button6" runat="server"
                      CommandName="MyButton1"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="Strongly Agree" />
                    </ItemTemplate>
                    <ControlStyle Font-Bold="False" Font-Size="Smaller" ForeColor="#006600" />
                    <HeaderStyle Font-Size="Small" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Agree" HeaderStyle-Font-Size ="Small" ControlStyle-Font-Bold ="false"
                                            ControlStyle-Forecolor ="#009900"
                    ControlStyle-Font-Size ="Smaller">
                    <ItemTemplate>
                        <asp:Button ID="Button7" runat="server"
                      CommandName="MyButton2"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="Agree" />
                    </ItemTemplate>
                    <ControlStyle Font-Bold="False" Font-Size="Smaller" ForeColor="#009900" />
                    <HeaderStyle Font-Size="Small" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Undecided" HeaderStyle-Font-Size ="Small"
                                            ControlStyle-Font-Bold ="false" ControlStyle-Forecolor ="SlateGray"
                                            ControlStyle-Font-Size ="Smaller">
                    <ItemTemplate>
                        <asp:Button ID="Button8" runat="server"
                      CommandName="MyButton3"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="Undecided" />
                    </ItemTemplate>
                    <ControlStyle Font-Bold="False" Font-Size="Smaller" ForeColor="SlateGray" />
                    <HeaderStyle Font-Size="Small" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Disagree" HeaderStyle-Font-Size ="Small"
                                            ControlStyle-Font-Bold ="false" ControlStyle-Forecolor ="#FF6600"
                                            ControlStyle-Font-Size ="Smaller">
                    <ItemTemplate>
                        <asp:Button ID="Button9" runat="server"
                      CommandName="MyButton4"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="Disagree" />
                    </ItemTemplate>
                    <ControlStyle Font-Bold="False" Font-Size="Smaller" ForeColor="#FF6600" />
                    <HeaderStyle Font-Size="Small" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Strongly Disagree" HeaderStyle-Font-Size ="Small"
                                            ControlStyle-Font-Bold ="false" ControlStyle-Forecolor ="DarkRed"
                                            ControlStyle-Font-Size ="Smaller">
                    <ItemTemplate>
                        <asp:Button ID="Button10" runat="server"
                      CommandName="MyButton5"
                      CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                      Text="Strongly Disagree" />
                    </ItemTemplate>
                    <ControlStyle Font-Bold="False" Font-Size="Smaller" ForeColor="DarkRed" />
                    <HeaderStyle Font-Size="Small" />
                </asp:TemplateField>
 
                </Columns>
                <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                <HeaderStyle BackColor="White" Font-Bold="False" ForeColor="#000066" />
                <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                <RowStyle BackColor="White" ForeColor="#003399" />
                <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                <SortedAscendingCellStyle BackColor="#EDF6F6" />
                <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                <SortedDescendingCellStyle BackColor="#D6DFDF" />
                <SortedDescendingHeaderStyle BackColor="#002876" />
            </asp:GridView>



 


   Private Sub GridView2_RowCommand1(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView_Questions.RowCommand
        Try

            If Me.Label_LoggedIn.Text = "Not logged in" Then
                Me.Label_Error1.Text = "Please log in to complete this survey"
                Exit Sub
            Else
                Me.Label_Error1.Text = ""
            End If

            If (e.CommandName = "MyButton1") Then
                ' Retrieve the row index stored in the CommandArgument property.
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)

                ' Retrieve the row that contains the button
                ' from the Rows collection.
                Dim row As GridViewRow = GridView_Questions.Rows(index)

                row.Cells(5).BackColor = Drawing.Color.DarkGreen
                row.Cells(6).BackColor = Drawing.Color.DarkGreen
                row.ForeColor = Drawing.Color.White

                Dim Q As Integer = CInt(row.Cells(5).Text)

                If Q < 6 Then
                    row.BackColor = Me.G.ForeColor
                ElseIf Q > 5 And Q < 11 Then
                    row.BackColor = Me.R.ForeColor
                ElseIf Q > 10 And Q < 16 Then
                    row.BackColor = Me.E.ForeColor
                ElseIf Q > 15 And Q < 21 Then
                    row.BackColor = Me.A.ForeColor
                ElseIf Q > 20 And Q < 26 Then
                    row.BackColor = Me.T.ForeColor
                ElseIf Q > 25 Then
                    row.BackColor = System.Drawing.Color.SandyBrown
                End If



            ElseIf (e.CommandName = "MyButton2") Then
                ' Retrieve the row index stored in the CommandArgument property.
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)

                ' Retrieve the row that contains the button
                ' from the Rows collection.
                Dim row As GridViewRow = GridView_Questions.Rows(index)

                'row.BackColor = Drawing.Color.LightGray


                row.Cells(5).BackColor = Drawing.Color.Green
                row.Cells(6).BackColor = Drawing.Color.Green
                row.ForeColor = Drawing.Color.White

                Dim Q As Integer = CInt(row.Cells(5).Text)

                If Q < 6 Then
                    row.BackColor = Me.G.ForeColor
                ElseIf Q > 5 And Q < 11 Then
                    row.BackColor = Me.R.ForeColor
                ElseIf Q > 10 And Q < 16 Then
                    row.BackColor = Me.E.ForeColor
                ElseIf Q > 15 And Q < 21 Then
                    row.BackColor = Me.A.ForeColor
                ElseIf Q > 20 And Q < 26 Then
                    row.BackColor = Me.T.ForeColor
                ElseIf Q > 25 Then
                    row.BackColor = System.Drawing.Color.SandyBrown
                End If

            ElseIf (e.CommandName = "MyButton3") Then
                ' Retrieve the row index stored in the CommandArgument property.
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)

                ' Retrieve the row that contains the button
                ' from the Rows collection.
                Dim row As GridViewRow = GridView_Questions.Rows(index)

                'row.BackColor = Drawing.Color.LightGray


                row.Cells(5).BackColor = Drawing.Color.SlateGray
                row.Cells(6).BackColor = Drawing.Color.SlateGray
                row.ForeColor = Drawing.Color.White

                Dim Q As Integer = CInt(row.Cells(5).Text)

                If Q < 6 Then
                    row.BackColor = Me.G.ForeColor
                ElseIf Q > 5 And Q < 11 Then
                    row.BackColor = Me.R.ForeColor
                ElseIf Q > 10 And Q < 16 Then
                    row.BackColor = Me.E.ForeColor
                ElseIf Q > 15 And Q < 21 Then
                    row.BackColor = Me.A.ForeColor
                ElseIf Q > 20 And Q < 26 Then
                    row.BackColor = Me.T.ForeColor
                ElseIf Q > 25 Then
                    row.BackColor = System.Drawing.Color.SandyBrown
                End If

            ElseIf (e.CommandName = "MyButton4") Then
                ' Retrieve the row index stored in the CommandArgument property.
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)

                ' Retrieve the row that contains the button
                ' from the Rows collection.
                Dim row As GridViewRow = GridView_Questions.Rows(index)

                'row.BackColor = Drawing.Color.LightGray

                row.Cells(5).BackColor = Drawing.Color.DarkOrange
                row.Cells(6).BackColor = Drawing.Color.DarkOrange
                row.ForeColor = Drawing.Color.White

                Dim Q As Integer = CInt(row.Cells(5).Text)

                If Q < 6 Then
                    row.BackColor = Me.G.ForeColor
                ElseIf Q > 5 And Q < 11 Then
                    row.BackColor = Me.R.ForeColor
                ElseIf Q > 10 And Q < 16 Then
                    row.BackColor = Me.E.ForeColor
                ElseIf Q > 15 And Q < 21 Then
                    row.BackColor = Me.A.ForeColor
                ElseIf Q > 20 And Q < 26 Then
                    row.BackColor = Me.T.ForeColor
                ElseIf Q > 25 Then
                    row.BackColor = System.Drawing.Color.SandyBrown
                End If

            ElseIf (e.CommandName = "MyButton5") Then
                ' Retrieve the row index stored in the CommandArgument property.
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)

                ' Retrieve the row that contains the button
                ' from the Rows collection.
                Dim row As GridViewRow = GridView_Questions.Rows(index)

                'row.BackColor = Drawing.Color.LightGray


                row.Cells(5).BackColor = Drawing.Color.DarkRed
                row.Cells(6).BackColor = Drawing.Color.DarkRed
                row.ForeColor = Drawing.Color.White

                Dim Q As Integer = CInt(row.Cells(5).Text)

                If Q < 6 Then
                    row.BackColor = Me.G.ForeColor
                ElseIf Q > 5 And Q < 11 Then
                    row.BackColor = Me.R.ForeColor
                ElseIf Q > 10 And Q < 16 Then
                    row.BackColor = Me.E.ForeColor
                ElseIf Q > 15 And Q < 21 Then
                    row.BackColor = Me.A.ForeColor
                ElseIf Q > 20 And Q < 26 Then
                    row.BackColor = Me.T.ForeColor
                ElseIf Q > 25 Then
                    row.BackColor = System.Drawing.Color.SandyBrown
                End If

            End If

        Catch ex As Exception
            Me.Label_Error1.Text = ex.Message
        End Try
    End Sub
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

If http://www.webexcel.co/ is the site you're talking about, it appears to be completely down at the moment.
Avatar of Murray Brown

ASKER

Hi
Sorry about that...the site is up again
Hi I just tried things on another Mac Book and it worked so the error seems specific on one computer
Have you modified the Maximum Worker Process setting in app pool?
I don't think so. Should I do that? If so, how would I do that?
No. I have seen a thread where user was getting error after increasing this number.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks. It turns out that all of the files hadn't loaded