1

We are using one load balance Server which redirect us to another four different server and other two servers which are not on the farm of load balance server. The configuration looks like completed perfectly from the administrator of the system.

The problem I face is that when I would like to have an HTTP web response and take the response headers I faced an issue. The problem I faced is that the Load balanced "link" which I use from load balance server does not give me the response I expect. I use the below code as example.

try
{
    var myHttpWebRequest = WebRequest.Create(url);
    myHttpWebRequest.Credentials = credentials;


    var myHttpWebResponse = myHttpWebRequest.GetResponse();
    myHttpWebResponse.Close();
}
catch (WebException e)
{
    Console.WriteLine("WebException: " + url);
    Console.WriteLine("Web Exception Status: " + e.Status);
    Console.WriteLine("\n");

    if (e.Status == WebExceptionStatus.ProtocolError)
    {
         Console.WriteLine(((HttpWebResponse)e.Response).Headers);
    }
}

Now, the WebExceptionStatus I take when execute the code on the load balanced server is "SendFailure" which does not give me any "response.headers" result.

If I install and use "curl"

curl [load balance server url] -k -I

on the command line I will take headers when I use load balance server URL.

enter image description here

In conclusion, my target is I would like to take and use theWebExceptionStatus, "X-FEServer","www-Authenticate" and "Date" for some purposes but it is not possible with the c# approach as above to be retrieved.

Please, make sure that you understand the load balanced server approach before any comment or answer. Any suggestion will be helpful

0 Answers0