Web test failing RequestFailed: The value of the date string in the header is invalid.

All webtests I run from VS2005 RTM are failing with a response of:
RequestFailed: The value of the date string in the header is invalid.

The request looks like this:
GET /Angel63/sidebar.asp HTTP/1.1
User-Agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Accept : */*
Accept-Language : en-US
Host : 600m01
Cookie : ASPSESSIONIDSATDSCQA=LMGPKPGDJNEPFDPPJKBKILEP
Accept-Encoding : gzip

I can successfully run the same test using the beta 2 release of VS2005.  The only thing I can see that is different is that the request is slightly different.

Request from VS2005 beta 2:
GET /Angel63/sidebar.asp HTTP/1.1
User-Agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host : 600m01
Cookie : ASPSESSIONIDSATDSCQA=NMGPKPGDMBICICLNHBOBLFIH

The response header I get from VS2005 beta2 is:
HTTP/1.1 200 OK
Date : Wed, 07 Dec 2005 13:17:38 GMT
Last-Modified : 12/7/2005 8:12:38 AM,12/7/2005 8:12:38 AM,12/7/2005 8:12:38 AM,12/7/2005 8:12:38 AM,12/7/2005 8:12:38 AM
Server : Microsoft-IIS/5.1
X-Powered-By : ASP.NET
Content-Length : 4275
Content-Type : text/html
Expires : Wed, 07 Dec 2005 13:07:38 GMT
Cache-control : private

Does anyone know what causes this error, or what differences in the beta and rtm that may cause this

Thanks,
Chad



Answer this question

Web test failing RequestFailed: The value of the date string in the header is invalid.

  • Andrew Sims

    It looks like both your Expires and your Last-Modified headers are invalid.  I'm checking with the System.Net team to figure out if there's any way to work around this bug.  I do not currently know of a workaround other than fixing those headers.  Once I find out if there's something that can be done in the short term, I'll post it here.

    Josh

  • Anand Nambisan

    Yes, I try it is not possible to change software. So if it is possible to get those changes as soon as possible I will be glad to have them. Now we are testing our portal trying to find perfomance issuers. So I really want to use VS2005 for this and try to make VS as test tool standard. But this problem does not allow me to make VS as a standard test environment.

     

    Eugene


  • Mike Eheler

    Evgeny,

    I've identified a way we can correct this bug, but it involves recompiling the web test engine.  This fix will be included in the upcoming service pack.  If you have a support contract, you could request a QFE for this bug and possibly get it sooner.

    Have you tried contacting the makers of the software that's generating the invalid Last-Modified header

    Josh



  • Jawad Munir

    Chad,
    Does your web app set the Last-Modified header multiple times   I believe that's where the bug exists since that header value is not valid.  Beta 2 was less sophisticated about how it cached requests, so it must not have been trying to parse that Last-Modified value.

    Josh

  • martinbl

    Sorry about that, I just realized I had an error in the way I was reproducing your problem.  That workaround doesn't work for me either.  I'm talking to the System.Net team to see if we can figure anything else out that might work, but it seems unlikely at least in the short term.

    Josh

  • Jeff Lynch - MVP

    Can you tell me what version you have listed in the Visual Studio about box   We did some more investigation and it appears I actually fixed this bug a few weeks before RTM.

    Thanks,
    Josh



  • Ars_Maxer

    I did find the following line in one of our "common" include files:
     Response.AddHeader "LAST-MODIFIED", FormatDateTime(DateAdd("n", -5, Now()))

    I assume this was added to try to keep pages from caching.

  • emeshuris

    I now have a repro for this bug on my machine.  The bug we fixed applied to the Date header, but it looks like an invalid Last-Modified header is throwing a ProtocolViolationException in a helper class used by System.Net.HttpWebResponse.  We'll work with the team that owns that code to get a resolution to this bug.  In the meantime, I'd suggest trying to figure out why that invalid Last-Modified header is being set.  That will surely cause client-side caching not to work properly even if IE does permit the header.

    Josh



  • codoherty

    Here's a workaround that should allow you to test against web servers returning invalid Last-Modified headers.  Just add the following XML to vstesthost.exe.config in your \program files\vs...\common7\ide directory.  It needs to go in between the <configuration> and </configuration> tags.

    Please let me know if this works for you.

        <system.net>< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

            <settings>

                <httpWebRequest useUnsafeHeaderParsing="true" />

            </settings>

        </system.net>



  • JurgenJ

    Let me just add that I'm filing a bug on this.  Even if the header is invalid, we should ignore it instead of fail the request.

    Josh

  • Chuck Fain

    I have the same problem, but in my case I try to test Plumtree portal. And they response header looks like:
    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Thu, 08 Dec 2005 18:41:23 GMT
    X-Powered-By: ASP.NET
    X-AspNet-Version: 1.1.4322
    Pragma: no-cache
    Content-Language: en
    Set-Cookie: ASP.NET_SessionId=cfgjo0qj0vpegf55ygn43y3u; path=/
    Expires: 1133980883540
    Cache-Control: no-store, no-cache, must-revalidate, max-age=0
    Cache-Control: post-check=0, pre-check=0
    Last-Modified: 1134067283540
    Content-Type: text/html; charset=utf-8
    Content-Length: 25385

    Is there some work around to make this test working

  • Yifat

    That explains it.  I suggest that you don't set the Last-Modified header directly since it has a very specific format for the date and FormatDateTime() obviously isn't respecting that format.  You can avoid formatting problems as well as the problem with the header value being added multiple times by using Response.Cache.SetLastModified(DateTime) instead.  If you're just trying to prevent caching, I'd suggest using Response.Cache.SetCacheability(HttpCacheability.NoCache) instead of setting an already expired Last-Modified header.

    I hope that helps.

    Josh


  • ArunRajan

    Microsoft visual Studio 2005
    Version 8.0.50727.42 (RTM.050727-4200)


    Microsoft .NET Framework
    Version 2.0.50727


  • dlausch

    Sorry, but it did not help me. I veryfied  that TestTool reads that setting (put wrong string in config file), but I still have the same error message.
  • Web test failing RequestFailed: The value of the date string in the header is invalid.