Pages

Friday, November 30, 2007

Sara Ford's Tip of the Day Sidebar Gadget

Sara Ford works at Microsoft as a Program Manager and blogs about Visual Studio. There's a VS2005 Tip of the Week and a VS2008 Tip of the Day. She used to be a test dev and has some video interviews on MSDN channel 9.

Rob Caron wrote a sidebar gadget for Visual Studio 2008 Tip of the Day. You can download it here.

This is a great resource for people like me who are new to the development environment.

Wednesday, November 14, 2007

ASP.NET __VIEWSTATE in recorded web tests - Validation of viewstate MAC failed

I'm not a developer, so I wasn't sure what was happening at first. I got a new machine, but couldn't run recorded web tests on it. There were error messages when I tried to run the recorded web tests on the new machine that were recorded on the old machine. Here's how I figured out what was happening.

The original error message didn't make sense to me until later. It said "Validation of viewstate MAC failed. If the application is hosted by a web farm of cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster"

At first I thought something was wrong with machine.config or web.config. I searched for the error message and read this forum post about adding changing web.config to add entries to the pages tag:
validateRequest="false"
enableEventValidation="false"
viewStateEncryptionMode ="Never"

That didn't work, so I found the request where the errors happened and tried deleting the Form Post Parameters that referred to __VIEWSTATE=

That didn't work, so I read about __VIEWSTATE this article explained that Viewstate contains user entered information encrypted in a hidden POST form field so users don't have to re-enter information after moving to another page.

Then I recorded a web test to get the updated encrypted VIEWSTATE=/whGSTdfdbdjdfy and copied the updated value to the other web tests. I also found a post that tells how to make the viewstate dynamic, but I only have Visual Studio installed on one machine now.

Monday, November 12, 2007

Don't forget to Run as Administrator on Vista

For Recorded Web Tests; the recorder bar will show up in IE but the controls are disabled unless you run Visual Studio as Administrator. Right click the Start Menu shortcut to select "Run as Administrator".

There's also check box to always run as administrator under the Compatibility tab of the shortcut. My boss told me about that today.

Here's a blog post about troubleshooting the Web Test Recorder bar:

New machine - webtests

We got new laptops recently. They're super awesome; HP Compaq 8710p; 4 GB RAM; 150 GB drive; Intel Core Duo CPU T7100 1.80 GHz; CD/DVD combo drive with burner

Right now I'm updating the web tests to work on this machine. It seems like some parameters in the web tests contain encoded information about the old machine. For certain things I was able to do Find In Files and Replace text values, since web tests are stored in XML format.

Here's what I changed in web tests on new laptop:

1) Replace in Files: path to text files used in Data Sources
2) Replace in Files: web application URL
3) Delete and Insert the Data Sources - left the existing bindings when deleting the data source
4) Record a web test on the new machine to get the updated VIEWSTATE and replace __VIEWSTATE=/hdnsytYTTfwjkwkmi from the old machine with the new value for the new machine in the Form Post Parameters
5) Delete __VIEWSTATE=/WkdujnUWEUiwkmi from the Form Post Parameters

Add Data Source for Text File with Header Row:

1) Click Add Data Source button
2) Select the Microsoft Jet 4.0 OLE DB Provider under the OLE DB Provider choice list
3) Click Advanced button
4) Enter "Text;" without quotes in the first item under Advanced>Extended Properties
5) Click OK
6) Enter path to input file under the "Server or file name" text box - without file name
7) Click Test Connection
8) Click OK at "Test connection succeeded' message
9) Click OK to close the Add Data Source dialog
10) Select check box next to input file used in the web test and click OK