Solved

ASP.net VB.net error with Mac Book

Posted on 2013-11-04
8
352 Views
Last Modified: 2013-11-06
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
0
Comment
Question by:murbro
  • 4
  • 2
  • 2
8 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39620964
If http://www.webexcel.co/ is the site you're talking about, it appears to be completely down at the moment.
0
 

Author Comment

by:murbro
ID: 39621007
Hi
Sorry about that...the site is up again
0
 

Author Comment

by:murbro
ID: 39621028
Hi I just tried things on another Mac Book and it worked so the error seems specific on one computer
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39621210
Have you modified the Maximum Worker Process setting in app pool?
0
 

Author Comment

by:murbro
ID: 39621242
I don't think so. Should I do that? If so, how would I do that?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39621954
No. I have seen a thread where user was getting error after increasing this number.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39622220
Today your site loads fine in Safari on my MacBook Pro and here on my PC.
0
 

Author Closing Comment

by:murbro
ID: 39627419
Thanks. It turns out that all of the files hadn't loaded
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# LINQ ForEach() question 6 54
Optimize the query 5 43
Looping through datagridview and dataset ? 6 24
Get month and date in a format 4 31
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question