Search code examples
c#-4.0webdavmsxmlendpointxmlhttprequest

Bind endpoint(specific IP) to MSXML Request?


Hi I do IPEndpoint binding to my WebRequests as below

 if (!ipAddress.Equals(myLocalIP))
            {
                request.ServicePoint.BindIPEndPointDelegate =
                   delegate(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount)
                   {
                       return new IPEndPoint(IPAddress.Parse(ConfigurationManager.AppSettings["SS_Outbound_IP"]), 0);
                   };
            }

I need to do the same to MSXML Request. Here is my MSXML Request.

 var xmlHttp_ = new XMLHTTP();
        Console.WriteLine("My IP is: "+FindMyPublicIPAddress());
        // Build the query.
        string requestString =
            "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" +
            "<a:propfind xmlns:a=\"DAV:\">" +
            "<a:prop>" +
            "<a:displayname/>" +
            "<a:iscollection/>" +
            "<a:getlastmodified/>" +
            "</a:prop>" +
                "</a:propfind>";

            // Open a connection to the server.
            xmlHttp_.open("PROPFIND", Uri, false, "UserName","Password");

            // Send the request.
            xmlHttp_.setRequestHeader("PROPFIND", requestString);
            xmlHttp_.send(null);


        // Get the response.
        string folderList = xmlHttp_.responseText;

Any Suggestions will be greatly appreciated.


Solution

  • I realized that, we cannot make endpoint binding with MSXML