title: Force HttpWebRequest to use HTTP 1.0 and set UserAgent in PCL for Windows 8
body: <p>I have created a class within my PCL to get the needed Session-Id and a Key for login into a webserver. (The response is XML, which is parsed in a second method which runs the Login) I have no control on the WebServer, so I need to solve my problem on the client side.</p>
  
  <p>This is my Task Method:</p>
  
  <pre><code>public static async Task&lt;string&gt; SessionId()
  {
      HttpWebRequest SessiondIdRequest = (HttpWebRequest)WebRequest.Create(Constants.SessionIdUrl);
  
      SessiondIdRequest.Method = "POST";
      SessiondIdRequest.Accept = "application/xml";
      SessiondIdRequest.Headers[HttpRequestHeader.AcceptLanguage] = "de-de,de;q=0.8,en-us;q=0.5,en;q=0.3";
      SessiondIdRequest.ContentType = "application/x-www-form-urlencoded ";
  
  
      string appIDviaPOST = "{Here is a String}";
      byte[] byteArray = Encoding.UTF8.GetBytes(appIDviaPOST);
  
      using (var SessionIdRequestStream = await Task&lt;Stream&gt;.Factory.FromAsync
          (SessiondIdRequest.BeginGetRequestStream, SessiondIdRequest.EndGetRequestStream, SessiondIdRequest))
      {
          await SessionIdRequestStream.WriteAsync(byteArray, 0, byteArray.Length);
      }
  
     WebResponse SessionIdRequestResponse = await Task&lt;WebResponse&gt;.Factory.FromAsync
         (SessiondIdRequest.BeginGetResponse, SessiondIdRequest.EndGetResponse, SessiondIdRequest);
     var SessionIdRequestResponseStream = SessionIdRequestResponse.GetResponseStream();
      var sr = new StreamReader(SessionIdRequestResponseStream);
      string SessionIdResult = await sr.ReadToEndAsync();
  
      return SessionIdResult;
  }
  </code></pre>
  
  <p>The Task works very well on WP7 &amp; WP8. I am getting a totally different result when I am using this Method in the Windows 8 part of my app. </p>
  
  <p>I used Fiddler to find out the differences between the two, the most markable thing I saw that WP7&amp;8 are using HTTP 1.0 and send an UserAgent, whereas Win8 uses HTTP 1.1 and does not send an UserAgent.</p>
  
  <p>In PCL, the HttpWebRequest does not contain properties for UserAgent and ProtocolVersion, so I am not able to tell the Method to force it (because it is a subset only).</p>
  
  <p>Is there any way to work around this (besides to copy the whole method into my Win8 project, where I am able to set those properties).</p>
  
  <p>I am very new to MVVM and PCL, so please be a bit forgiving it this is a dumb question for you.
  Thanks.</p>