title: C# - WebRequest: Too many automatic redirections were attempted
body: <p>I have a problem with the automatic redirects while using the class WebRequest.
  I create a simple application that can log in (using login and password) to the website and download some contents.</p>
  
  <p>I read that a common reason is the lack of CookieContainer. In my case, everything works fine until the cookies are turned off. Then the redirections works well, but - in this way - I will never logged in to my account (I don't support cookies)... when I try to turn on cookies, I receive a communicate: "too many redirects" - but it isn't true. Log in to the web application requires exactly two redirects - I know it and I checked my opinion. It isn't the bug of webpage application. </p>
  
  <p>The source code:</p>
  
  <pre><code>private string DoGETrequest(string url)
      {
          // settings
          System.Net.ServicePointManager.Expect100Continue = false;
          //
  
          var request = (HttpWebRequest)WebRequest.Create(url);
          request.CookieContainer = cookieContainer;
  
  
          request.Method = "GET";
          request.ContentType = "application/x-www-form-urlencoded";
  
          var response = (HttpWebResponse)request.GetResponse();
          Uri responseUri = response.ResponseUri;
  
          var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
  
          return responseString;
      }
  </code></pre>
  
  <p>I would like to avoid the problem with maximum amount of redirections and as well as accept the cookies, that is necessary to login.
  The best solution is using WebRequest, because this method is only one part of largest application, so I would like to ask you about the possibility of modifying the current code.</p>