Sporadic Viewstate errors

Last post 05-15-2013, 8:40 PM by jk121960. 6 replies.
Sort Posts: Previous Next
  •  05-13-2013, 9:34 PM 77423

    Sporadic Viewstate errors

    Hi, I am using Ajaxuploader and it is mostly successful, but I am getting some errors for failed viewstate show below,  I am not on a farm, just a single web server database is seperate and I am not putting session in sqlserver. The server is a professional hoster and all mochine keys are set. Does someone have an idea of what this is?

     

    thanks for any help

     

     

    Server side exception, failed to upload dwa140_revB_linux_drivers_2130.zip


    Debug Information:


    System.Web.HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that \x3CmachineKey\x3E configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. ---\x3E System.Web.UI.ViewStateException: Invalid viewstate. \x0D\x0A      Client IP: 108.89.22.112\x0D\x0A      Port: 52523\x0D\x0A      Referer: http://www.shiftsmartspot.com/Submit/FileUpload\x0D\x0A      Path: /UploadHandler.ashx\x0D\x0A      User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 Chrome/25.0.1364.160 Safari/537.22\x0D\x0A      ViewState: /wEWAQUgQzpcV2luZG93c1xURU1QXEFqYXhVcGxvYWRlclRlbXB9zsJ6V51SAKhKUOM4ZOPJAdtUEjLBZLK3CU1CfABbdQ==\x0D\x0A   at System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState)\x0D\x0A   at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose)\x0D\x0A   at CuteWebUI.b.a(String A_0)\x0D\x0A   at CuteWebUI.UploaderProvider.a(HttpContext A_0, IAjaxUploader A_1, Boolean A_2)\x0D\x0A   at CuteWebUI.UploadModule.e(HttpContext A_0)
     

  •  05-14-2013, 12:01 PM 77426 in reply to 77423

    Re: Sporadic Viewstate errors

    Hi jk121960,

     

    Please refer to http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx, it should fix your error.

     

    Regards,

     

    Ken 

  •  05-14-2013, 1:10 PM 77427 in reply to 77426

    Re: Sporadic Viewstate errors

    Sorry I should have stated this before but I am using MVC not webforms, but I did set these items in the webconfig pages section and still no joy, we are not using a web farm but we are using a professionally hosted dedicated server and the IT has made sure that all the keys are set right. This error comes up in a dialog during upload of the file bfore I post so during the ajax portion. Strangly it was working fine for quite a while.

     

    Any help is appreciated 

     

    thanks  

  •  05-14-2013, 9:11 PM 77432 in reply to 77427

    Re: Sporadic Viewstate errors

    Hi jk121960,

     

    Do you get the same problem with the default demo pages of the download package?

     

    Is your site online? If so, can you post your uploader page url and the full steps to reproduce this issue? So we can check it too.

     

    Or send to Kenneth@CuteSoft.net

     

    Regards,

     

    ken 

  •  05-14-2013, 10:37 PM 77433 in reply to 77432

    Re: Sporadic Viewstate errors

    Hi and thanks, I got this problewm solved by a local machine key not even the IIS one, but now the file size which worked fine is now on the fritz, I just for a filure on a 50 MG file, I have set max request in webconfig to max size 2GB, I have set IIS Request filtering to max 2GB, I have removed the entery from the machine.config. I even found the appsettings entries for the upload module which i added and set to 2GB, I have no idea at this point what the problem is. I have never had this probelm with uploads before.

     

    Many thanks for any  help

     

    I found a setting in the upload handler and I also set that to 2 GB, I am still getting the following error

     

    System.Threading.ThreadAbortException: Thread was being aborted.
       at System.Web.Hosting.UnsafeIISMethods.MgdReadEntityBody(IntPtr pHandler, Byte[] pBuffer, Int32 dwOffset, Int32 dwBytesToRead, Boolean fAsync, Int32& pBytesRead, IntPtr& ppAsyncReceiveBuffer)
       at System.Web.Hosting.IIS7WorkerRequest.ReadEntityCoreSync(Byte[] buffer, Int32 offset, Int32 size)
       at CuteWebUI.p.ReadEntityBody(Byte[] buffer, Int32 size)
       at CuteWebUI.a.a(HttpContext A_0, HttpWorkerRequest A_1, MemoryStream A_2, FileStream A_3, String& A_4, String& A_5)
       at CuteWebUI.a.b(HttpWorkerRequest A_0)
       at CuteWebUI.UploadModule.e(HttpContext A_0)
     

  •  05-15-2013, 12:10 PM 77438 in reply to 77433

    Re: Sporadic Viewstate errors

    Hi jk121960,

     

    Just list the large file upload settings below, please check it and ensure that you have set all of them correct. 

     

    1. maxRequestLength in web.config

     

     <httpRuntime maxRequestLength="value"/> 

     

    2. maxAllowedContentLength in IIS

     

    Edit the request filtering feature settings and the request limits using IIS manager

    1. )Open IIS Manager.
    2. Select the website that you want to configure.
    3. Make sure you are in Features View per the button at the bottom of the manager.
    4. Select Requests Filtering and open it by double-clicking the icon. The Request Filtering pane displays.
    5. From the Actions pane on the right hand side of the screen click Edit Feature Settings... link. The Edit Request Filtering Settings window displays.
    6. In the Request Limits section, enter the appropriate Maximum allowed content length (Bytes) and then click the OK button.
    7. Restart IIS.

     

    3. Do not set property "MaxSizeKB" for the uploader control. 

     

    4. Set property "TempDirectory" for the uploader control. This property needs to set in the controller and the handler both and set to the same value.

     

    Create an folder under your site root and set it for property "TempDirectory". 

     

    controller code

     

    using (CuteWebUI.MvcUploader uploader = new CuteWebUI.MvcUploader(System.Web.HttpContext.Current))
                {
             uploader.TempDirectory = "~/myTemp";
    }
     
    Handler code
     
    public override void OnUploaderInit(MvcUploader uploader)
        {
             //change photo to your folder name
            uploader.TempDirectory ="~/myTemp";
        }
     
     
    If you have set all of them and still get problem, then please show me all the values what you set for, so I can check it too.
     
    Regards,

     

    Ken 

  •  05-15-2013, 8:40 PM 77440 in reply to 77438

    Re: Sporadic Viewstate errors

    The IIS stuff I already had, I did set maxkb on the uploader and I had set the temp but only in the controller and that casued a problem, so I backed itout. But I will try that noww on both and take the value off the maxkb and let you know, thanks very much

     

View as RSS news feed in XML