Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receiving POST data in .ashx file

I have implemented a generic handler to work as a restful web service in ASP.Net. I have a problem receiving the XML file that is being posted to this web service. I cannot actually see anything being passed. I have gone through the form, querystring, and file properties of the request object. Everything is empty. I know that the file has been posted correctly because I can see it while using a port sniffer.

How can I access this file?

like image 289
fizch Avatar asked Feb 21 '11 21:02

fizch


1 Answers

After hours of searching, of course I found the answer after posting my question here. I was able to access the file using a stream reader. The code looks like this.

    Dim reader As New IO.StreamReader(context.Request.InputStream)
    Dim xmlFile As String = reader.ReadToEnd()
like image 159
fizch Avatar answered Nov 16 '22 11:11

fizch