0

I have an application that uses an HTTPWebRequest and works fine on the dev box. This box is running IIS Express 7.5

When deploying this application to another server, running IIS 6, the GetResponse() never returns. There is no error message, no timeout, or anything else. Sample code is as follows:

        string url = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath + String.Format("/FolderName/PageName.aspx");


        WebRequest request = WebRequest.Create(url);
        request.Method = "GET";
        request.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

        request.Headers.Add("x", _x);
        request.Headers.Add("y", _y);
        request.Headers.Add("z", _z);

        // this line never returns in IIS 6
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        Stream dataStream = response.GetResponseStream();

        StreamReader reader = new StreamReader(dataStream);


        string s = reader.ReadToEnd();

        reader.Close();
        dataStream.Close();
        response.Close();
Paul
  • 2,330
  • 2
  • 19
  • 18

1 Answers1

0

Turns out this was due to invalid SSL Cert on the IIS6 server...

Way to get by is here (for testing purposes only): How do I use WebRequest to access an SSL encrypted site using https?

Community
  • 1
  • 1
Paul
  • 2,330
  • 2
  • 19
  • 18