I am seeing an odd problem when testing our web site. I have no problems navigating through our website manually from a web browser and experience no problems when creating a web test that navigates through our web site. But, when I run the web test I created, then I keep getting an "Internal Server Error" on the first server page transfer.
When I look at our server logs it indicates that the problem is caused by an invalid ViewState. But, this problem only occurs when playing back (running) one of my web tests.
The ViewState appears to be formatted correctly (it can be parsed) but the error message gives no further indication of what might be wrong with the ViewState.
The pages are all running on a single server and I verified that we are not setting the second parameter to true when we call Server.Transfer().
The fact that this problem doesn't occur at all when manually navigating through the web site or when creating the test, but occurs _every_ time I run the web test, seems to indicate that something is happening to the ViewState when the test is run. I'm almost wondering if the tests are capturing the ViewState from my original run (during test creation) and are continuing to use the same ViewState values during the tests instead of using the actual current viewstate values
Thanks!
-Sandra

Web tests resulting in Internal Server error due to Invalid ViewState
valef
replace the hard coded view state shown in my prior post with this code:
request1Body.FormPostParameters.Add(
"__VIEWSTATE", this.Context["$HIDDEN1.__VIEWSTATE"].ToString());Is this the recommended solution
Pomi
I am slightly disappointed that I have not had a reply to my previous post. This issue is a key one IMHO and one that was not sorted by the July CTP.
Antonio_Taganini
uanesp
Please try out the new CTP and let me know how it works for you.
Josh
RabJ
Even with using the correct form for the statement, as shown here:
"__VIEWSTATE", this.Context["$HIDDEN1.__VIEWSTATE"].ToString());I still get exceptions on multiple requests, like shown below, at the above line of code. Obviously, there is still something (a lot) I don't understand about view state and web tests. Any tips are appreciated.request1Body.FormPostParameters.Add(
System.Collections.Generic.KeyNotFoundException was unhandled by user code
Message="The given key was not present in the dictionary."
Source="mscorlib"
StackTrace:
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.VisualStudio.TestTools.WebTesting.WebTestContext.get_Item(String key)
at TestProject1.WebTest1Coded.<GetRequestEnumerator>d__0.MoveNext() in M:\Visual Studio Projects\TestProject1\TestProject1Sln\TestProject1\WebTest1Coded.cs:line 60
at Microsoft.VisualStudio.TestTools.WebStress.WebTestCaseVariation.ExecuteNextTopLevelRequest()
arazy
Open the test in the web test editor and go to the request that is having a problem. Does this request have the view state set to the recorded value or is bound to a context parameter which pulls the view state from a hidden field
Alex Krawarik
this original post just added to the confusion, so I deleted it.
mike2281
Thanks.
A K
this original post just added to the confusion, so I deleted it.
micTronic
Thanks,
Josh
Keith Kaimsinki
Thanks for your posting. I'm working with Sandra (original poster) on this issue. It seems that in VSTS the hidden_viewstate is recording the actual recorded value of the viewstate.
I have tried several load testing software packages - all seem to record the web test without error - but most have errors when we "replay" them - all pointing to viewstate as the issue where we redirect the webpage.
Will downloading and installing the new CTP resolve some of our errors
balajikoturu
I just recorded a web test and generated code so I can email you an unmodified coded test.
When I looked thru the generated code just now, I noticed both of these statements:
request8Body.FormPostParameters.Add(
"__VIEWSTATE", "$HIDDEN1.__VIEWSTATE");and
request9Body.FormPostParameters.Add(
"__VIEWSTATE", this.Context["$HIDDEN1.__VIEWSTATE"].ToString());Therefore, I am now confused about whether and when I should use either of these 2 different forms of the code statement.
Which format is correct
Regards,
Mountain
P.S. On this forum I have "Alert Me" checked and I have a list of threads in my subscriptions area, but I never receive any alerts on replies to my posts.
Govert van Drimmelen
I am using VS 2005 version 8.0.50727.7.
I am having the Invalid ViewState problems and I see that ViewState is hard coded into my tests as follows:
request11Body.FormPostParameters.Add(
"__VIEWSTATE", "dDwtMTU3NTAyxPDtsPGkxxx8aTwxPjtpPDM+O2k8NT47aTw3PjtpPDk+O2k8M" +"TE+O2k8MTMxxDx0PDtsPGk8MD47PjtsPHQ8O2w8aTwwPjs+O2w8dDw7bDxpP" +
lots more...
"DE+Oz47bDx0PPGk8MD47aTwyPjs+xx2k8Mj47PjtsPHQ8cDxwPGw8VGV4dDs+O" +
"2w8RGF2aWQgU2hpZWxkczs+O2w8KENTIEFkbWluKTs+Pjs+Ozs+O" +
"z4+Oz4+Oz4QLMCI87kxVd/aft7/JngFzHeR1w==");How can I remove this manually and specify that the test uses ViewState from the current context For the moment, I would prefer to just edit my coded web test, rather than install another CTP version and record new tests. (Plus, I think I already have the August CTP.)
Regards,
Mountain
YingWorkOnDSL
I can see that the hidden feild extraction and binding behaviour is differnet and too be fair these are no longer any occurences of hard recorded __VIEWSTATE.
However I still get an "Unable to Validate" exception thrown from MachineKey.GetDecodedData which was called during the loading of ViewState for the page.
The web site in question is an ASP.NET 1.1 site.
Any ideas
TIA
Pat Long