HttpListenerRequest POST values

How can i get POST values?
I want to build WebPage to upload files to MicroController. I need to get data from POST parameters.


HttpListenerRequest request = context.Request;
switch (request.HttpMethod.ToUpper())
{
      case "GET": ProcessClientGetRequest(context); break;
      case "POST":
            //What now??? 
            break;
}

You can get the request body (ie the data sent in the from the client) from the InputStream member of the HttpListenerRequest instance.

There should be tons of examples on internet.

Makla, take a look at this web server from Wouter: http://www.tinyclr.com/codeshare/entry/186

1 Like

This will do the trick. I already try this, before posting the post, but without success.


                                System.IO.Stream body = request.InputStream;
                                System.IO.StreamReader reader = new System.IO.StreamReader(body);
                                char[] buffer = new char[reader.BaseStream.Length];
                                reader.Read(buffer, 0, (int)reader.BaseStream.Length); //this works
                                string s = reader.ReadToEnd();    //This doesn't work. Program hangs here.

Yes, that would be much better, but i can’t find any good ftp server. The one on code share (NETMF FTP Server) is not stable. It also doesn’t work with FileZilla.

This looks interesting. Is there any new version somewhere?

I think, I will wait for some demo and code share.