How do I change the http version of my web method call to stop error 505?


I need to get some data from a service provider and have configured our .net app to point to their hosted web service to get the data. Using the code below, when the web method is called (ws.DoTransfer) I get the following error...

    private void DoTransferLocal()
            Version version = new Version();
            string error = string.Empty;
                    RemoteService ws = new RemoteService();
                    ServicePoint spm = ServicePointManager.FindServicePoint(new Uri(ws.Url));
                    spm.Expect100Continue = true;
                    version = spm.ProtocolVersion;
                    ws.Credentials = credentials;
                    ws.PreAuthenticate = true;
                    RemoteResult result = ws.DoTransfer();
                    MessageBox.Show("Result = " + result.transferStatus);
            catch (Exception ex)
                    error = ex.Message;
                    MessageBox.Show(version.ToString() + Environment.NewLine + error);


The request failed with HTTP status 505: HTTP Version Not Supported.

I've been told that the version of the HTTP needs to be 1.0, but mine is 1.1

I've read a couple of google posts about this and have seen suggestions to override the GetWebRequest method as shown here...

    protected override System.Net.WebRequest GetWebRequest(Uri uri)
            System.Net.HttpWebRequest request = base.GetWebRequest(uri) as System.Net.HttpWebRequest;
            request.ProtocolVersion = System.Net.HttpVersion.Version10;
            return request;

...but when I try this, the GetWebRequest after base. is underlined in red and has the error...

'Object' does not contain a definition for 'GetWebRequest'

Can anyone tell me how I change the HTTP version to 1.0, but still use similar code (rather than building up my own soap packets) to call my web method?

I can't seem to find any kind of code that I can simply inject into my code that looks like the following line...

    ws.HttpVersion = HttpVersion.Version10;


Change the Expect100Continue to false. You can do it in the config file of you app, adding the following:

            <servicePointManager expect100Continue="false" />