Hello, Robert.
We were unable to reproduce the problem. Our test ASP.NET 2.0 application running under UltiDev Cassini web server was able to read and return data received over HTTP PUT. Our sever application is essentially a lone HTTP handler. Here's the
code of the server application:
Code:<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using System.IO;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
HttpRequest req = context.Request;
if (req.RequestType == "PUT")
{
string data;
using (StreamReader reader = new StreamReader(req.InputStream))
data = reader.ReadToEnd();
context.Response.Write(data);
}
else
context.Response.Write("Hello World");
}
public bool IsReusable {
get {
return false;
}
}
}
We registered server application under UltiDev Cassini for ASP.NET 2.0. We assigned it port 5136.
Our client is a console application with looking like this:
Code:using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
namespace HttpPUTtestClient
{
class Program
{
static void Main(string[] args)
{
// Change this \/\/ port value to actual port number
string url = string.Format("http://{0}:5136/Handler.ashx", Environment.MachineName);
int count = 0;
do
{
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = "PUT";
using (Stream rs = req.GetRequestStream())
using (StreamWriter writer = new StreamWriter(rs))
writer.WriteLine(string.Format("Sent data {0}", ++count));
using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
using (StreamReader st = new StreamReader(resp.GetResponseStream()))
{
string m = st.ReadToEnd();
Console.WriteLine(m);
if (Console.ReadKey().Key == ConsoleKey.Escape)
return;
}
} while (true);
}
}
}
When we ran application, here's what we saw on the wire:
Request:
Code:PUT /Handler.ashx HTTP/1.1
Host: testmachine:5136
Content-Length: 13
Expect: 100-continue
Proxy-Connection: Keep-Alive
Sent data 1
Response:
Code:HTTP/1.1 200 OK
Server: UltiDev Cassini/2.1.4.3
Date: Tue, 11 Dec 2007 19:44:00 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Content-Length: 13
Connection: Close
Sent data 1
Please let us know if you can replicate our results.
Best regards,
UltiDev Team.
Please donate at
http://www.ultidev.com/products/Donate.aspx to help us improve our products.