Retrieving POST data in a .ashx file

I have implemented a generic handler to work as a soothing web service in ASP.Net. I have a problem getting the XML file that is sent to this web service. In fact, I do not see anything. I went through the form, querystring and file properties of the request object. Everything is empty. I know that the file was sent correctly, because I can see it using the portrector.

How can I access this file?

+3
source share
1 answer

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 is as follows.

    Dim reader As New IO.StreamReader(context.Request.InputStream)
    Dim xmlFile As String = reader.ReadToEnd()
+8
source

Source: https://habr.com/ru/post/1793710/


All Articles