Hi all, I'm having a problem with an HTTP POST and I discovered that GoDaddy disabled SSL 3.0 after the POODLE exploit came to light. This was working in production, and now only works in Visual Studio. This tells me I have a configuration issue with the server. We're running .NET 4.0 and I've enabled TLS 1.0, rebooted the IIS 7 server and updated the c# code which I've copied below. I've pasted the error at the bottom. I'm new to these forums, so hopefully I've posted this in the right place. Any help would be great!
HttpWebRequest httpRequest = (HttpWebRequest)HttpWebRequest.Create(new Uri(uri)); httpRequest.PreAuthenticate = false; httpRequest.AuthenticationLevel = System.Net.Security.AuthenticationLevel.None; httpRequest.AllowWriteStreamBuffering = true; httpRequest.Method = "POST"; httpRequest.Accept = "application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"; httpRequest.ContentType = "application/x-www-form-urlencoded"; httpRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)"; httpRequest.Headers.Add("Cache-Control:no-cache"); httpRequest.Headers.Add("DNT:1"); string postData = string.Format("XML={0}", Uri.EscapeDataString(Data)); byte[] bytes = Encoding.UTF8.GetBytes(postData); httpRequest.ContentLength = bytes.LongLength; ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; using (Stream requestStream = httpRequest.GetRequestStream()) { requestStream.Write(bytes, 0, bytes.Length); requestStream.Close(); } HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse(); string statusMessage = httpResponse.StatusDescription; using (StreamReader reader = new StreamReader(httpResponse.GetResponseStream(), Encoding.UTF8)) { statusMessage = reader.ReadToEnd(); response = statusMessage; }
WOTCBegin reqResponse: System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at MB.Navicus.UI.Portal.WOTCBegin.HttpPost2(String uri, String Data)