This post is related to http://forums.iis.net/p/1151402/1878121.aspx and http://forums.iis.net/p/1151147/1877070.aspx. I was able to reproduce the behaviour that is described there. The scenario is quiet simple. Create a simple "Hello World" asp.net page that is cachable like that:
<%@ OutputCache Duration="360" VaryByParam="none" Location="Any"%>
<html>
<head><title>Test</title></head>
<body>
<p>Hello World</p>
</body>
</html>
Now use a client that accepts the content type text/vnd.wap.wml only to request the page. IIS delivers the page with the content-type header set to the requested type and puts the page in the cache. While the page is cached any subsequent request will return the same header and content. Users who access the page get a download prompt until the cache expired.
The solution/workaround for the problem is quiet easy: Advise the cache to var by the "content-type" header by changing the header like that:
<%@ OutputCache Duration="360" VaryByParam="none" VaryByHeader="Content-Type" %>
However my preferred solution would be to prevent the IIS to deliver asp.NET files as text/vnd.wap.wml as long as I don't code it by myself. Does anyone know if there is a configuration setting for that?
P.S.: The following C# code simulates a device that accepts text/vnd.wap.wml only:
using System;
using System.IO;
using System.Net;
class Program
{
static void Main( string[] args )
{
string url = "http://webserver/test.aspx";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create( url );
request.Method = "GET";
request.UserAgent = "Test";
request.Accept = "text/vnd.wap.wml";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine( response.Headers.ToString() );
TextReader responseReader = new StreamReader( response.GetResponseStream() );
string content = responseReader.ReadToEnd();
Console.WriteLine( content );
Console.ReadKey();
}
}