How do I convert use of MSXML2.SERVERXMLHTTP from Classic ASP to C# in ASHX

For years we have been using the following vb code in a Classic ASP page to retrieve data from a software product.
To boost performance and get away from Classic ASP, I need to ASHX C# equivalent of the following  

    //set h = CreateObject("MSXML2.SERVERXMLHTTP")
    //"POST", "http://localhost/isapi/webapi.dll"  //this is a software provided dll that accepts xml objects and returns xml response objects
    //h.setOption(2) = 4096
    //response.Write("<br><textarea rows=\"20\" cols=\"60\">" + h.responseText + "</textarea>");    
    //for each response in h.responseXml.selectnodes("//Response")
    //response.Write("<br><textarea rows=\"20\" cols=\"60\">" + response.xml + "</textarea>");
Keith McElroyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontyWeb Ninja at largeCommented:
here's an example taken from here:

using System;
using MSXML2;  // Need to add a reference to C:\Windows\System32\msxml3.dll
namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            ServerXMLHTTP srv = new ServerXMLHTTP();
  "GET", @"", false,null,null);

Open in new window

Keith McElroyAuthor Commented:
I found and tried this before posting.
The ashx page tolerates the using MSXML2 but when I introduce  ServerXMLHTTP srv = new ServerXMLHTTP();
the page errs.  Screenshot of source

This example is using GET.  My example uses POST and I believe that along with the other parameters are mandatory
for the software provided dll to consume this request.

Need more help specific to the example.

Big MontyWeb Ninja at largeCommented:
the attached image doesnt show the error you're getting. Please copy and paste it here.
Keith McElroyAuthor Commented:
<!DOCTYPE html>

<html xmlns="">

    <form method="post" action="./DefaultRedirectErrorPage.aspx?aspxerrorpath=%2fFinance%2fxml%2fstyle%2fcustom%2fsjsf%2fTOWEBFRM%2frunner%2frunner.ashx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="VgIBDmu9oT6Y/7u89GwgU8wHga8mHvyXH6yfTWXMquBaHJ7OivahUHGVMe/MG/qDQ+bqbC5zS69JgC0CwCTy2T3pk2rnyIZjNlM5bdPqHIm3Izs/" />

<div class="aspNetHidden">

      <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="EAED47BF" />
      <input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
Ryan ChongSoftware Team LeadCommented:
〉〉To boost performance and get away from Classic ASP, I need to ASHX C# equivalent of the following  

you got to use .net class such as WebClient to send a web request.

there are also other similar ways to do that using other .net classes

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.