locked
The security validation for this page is invalid and might be corrupted, SharePoint, Web Performance Test RRS feed

  • Question

  • I  am trying  a  web performance test with Visual Studio 2010, but  it always failed. The process of recording is successful . But the result of runing test will show the  massege : "ErrorInfo":{"ErrorMessage":"The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your operation again.","ErrorValue":null,"ErrorCode":-2146232832,"ErrorTypeName":"Microsoft.SharePoint.SPException"}
    How can I solve the problem?

    Thanks

    Friday, March 2, 2012 12:02 PM

Answers

  • Hi Jiajia,

    visit the link for more details

    http://msdn.microsoft.com/en-us/library/dd583131%28v=office.11%29.aspx

    Testing your Custom Web Service

    After you deploy your .asmx file and your assembly, test your Web service. To test your Web service successfully, you must create a test application in Visual Studio .NET that uses SOAP to invoke the Web service methods. By default, custom Web services for Windows SharePoint Services only honor SOAP requests from their clients. If you try to test your Web service using a protocol other than SOAP, you receive the following error message:

    Microsoft.SharePoint.SPException: The security validation for this page is invalid and might be corrupted. Please use your Web browser's Back button to try your operation again.


    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you.

    Friday, March 2, 2012 2:02 PM
  • HI Jiajia,

    Here are some posts about "Performance testing SOAP-based applications"

    http://www.ibm.com/developerworks/webservices/library/ws-testsoap/ 

    http://msdn.microsoft.com/en-us/library/ms182557.aspx


    Wayne Fan

    TechNet Community Support



    Wednesday, March 7, 2012 7:30 AM

All replies

  • Hi Jiajia,

    visit the link for more details

    http://msdn.microsoft.com/en-us/library/dd583131%28v=office.11%29.aspx

    Testing your Custom Web Service

    After you deploy your .asmx file and your assembly, test your Web service. To test your Web service successfully, you must create a test application in Visual Studio .NET that uses SOAP to invoke the Web service methods. By default, custom Web services for Windows SharePoint Services only honor SOAP requests from their clients. If you try to test your Web service using a protocol other than SOAP, you receive the following error message:

    Microsoft.SharePoint.SPException: The security validation for this page is invalid and might be corrupted. Please use your Web browser's Back button to try your operation again.


    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you.

    Friday, March 2, 2012 2:02 PM
  • Thank you very much.

    Below is the generated code of the web test:

    WebTestRequest request2 = new WebTestRequest("http://....../_vti_bin/client.svc/ProcessQuery");
    request2.Method = "POST";
    StringHttpBody request2Body = new StringHttpBody();
    request2Body.ContentType = "text/xml";
    request2Body.InsertByteOrderMark = false;
    request2Body.BodyString = @"<Request AddExpandoFieldTypeSuffix=""true"" SchemaVersion=""14.0.0.0"" LibraryVersion=""14.0.4762.1000"" ApplicationName=""Silverlight Library"" xmlns=""<Actions><ObjectPath">http://schemas.microsoft.com/sharepoint/clientquery/2009""><Actions><ObjectPath Id=""29"" ObjectPathId=""28"" /><ObjectPath Id=""31"" ObjectPathId=""30"" /><ObjectPath Id=""33"" ObjectPathId=""32"" /><ObjectPath Id=""35"" ObjectPathId=""34"" /><ObjectIdentityQuery Id=""36"" ObjectPathId=""34"" /></Actions><ObjectPaths><StaticProperty Id=""28"" TypeId=""{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}"" Name=""Current"" /><Property Id=""30"" ParentId=""28"" Name=""Web"" /><Property Id=""32"" ParentId=""30"" Name=""Lists"" /><Method Id=""34"" ParentId=""32"" Name=""GetByTitle""><Parameters><Parameter Type=""String"">PO Header Query Close</Parameter></Parameters></Method></ObjectPaths></Request>";
    request2.Body = request2Body;
    yield return request2;
    request2 = null;

    Could you provide me more guidence on how to use SOAP to try the web performance test?

    Thanks

    Jiajia

    Monday, March 5, 2012 3:19 AM
  • HI Jiajia,

    Here are some posts about "Performance testing SOAP-based applications"

    http://www.ibm.com/developerworks/webservices/library/ws-testsoap/ 

    http://msdn.microsoft.com/en-us/library/ms182557.aspx


    Wayne Fan

    TechNet Community Support



    Wednesday, March 7, 2012 7:30 AM
  • Hi Jiajia

    I just faced the same problem, after some research I found out what was the problem. Let me explain

    When a Sharepoint service is consumed using webservices there is a paremeter in the header named x-requestdigest that validates security for the request.

    This x-requestdigest header prevents cross-site scripting. You can read more about it here: http://www.sharepointworld.in/2011/02/introduction-to-security-best-practices.html

    The solution is to check in the responses when calling a .asmx link for a parameter in a hidden field named __REQUESTDIGEST and create a correlation. Below an example:

    <input type="hidden" name="__REQUESTDIGEST" id="__REQUESTDIGEST" value="0xF887D8F908D09F80DA8F08D0F98D09S8F09D8SF09809DS8F098D098F09D8SF08DSAFAD9S8FADS0FD7F6D5F4D3F65F68FDSF876DSF45SA3DASF4DSA5F765DFF,19 Mar 2012 19:02:02 -0000" />

    So when posting the next request you should manually add the x-requestdigest parameter to the header so Sharepoint 2010 can validate it. The header will look something like this:

    POST /YourUrl.asmx HTTP/1.1
    Accept: */*
    x-requestdigest: 0xF887D8F908D09F80DA8F08D0F98D09S8F09D8SF09809DS8F098D098F09D8SF08DSAFAD9S8FADS0FD7F6D5F4D3F65F68FDSF876DSF45SA3DASF4DSA5F765DFF,19 Mar 2012 19:02:02 -0000
    Content-Type: text/xml
    Accept-Encoding: gzip, deflate
    Content-Length: 2006

    I was using LoadRunner so I cannot explain to you how to add a header with VSTS.

    Hope it is not too late for you. If you implement the solution please post what did you have to do to make it work with VSTS please.

    Regards



    • Proposed as answer by Rodo Ibarra Thursday, April 19, 2012 8:16 PM
    • Edited by Rodo Ibarra Thursday, April 19, 2012 8:34 PM
    Thursday, April 19, 2012 8:15 PM
  • Thanks a lot for this information!!!, I was having the same issue and thanks to this I was able to solve the problem and create the LoadRunner script.

    Thanks & Regards

    Oscar Ibarra- SR performance test engineer

    Thursday, November 28, 2013 9:57 PM