title: File post problem - ASP.Net
body: <p>I have to a web services method called uploadFile.the method getting a parameter as base64str and record as a file into the specified address it.
    But,I have a problem.That method doesn't allow to upload more than 350 KB file.Otherwise,I can upload less than 300 KB file e.g zip, jpg, txt. Also,
    When I attempt to upload more than 350 KB file,a process working continually on server.</p>
  
  <p>Process:</p>
  
  <pre><code>Image Name : w3wp.exe, UserName : ASP.Net v4.0, CPU : 50, Description : IIS Worker Process
  </code></pre>
  
  <p>Sometimes server cpu goes to 100% </p>
  
  <p>Code:</p>
  
  <pre><code>  * encodedFile = Base64Str as format
  
      string postString = string.Format("userName={0}&amp;userVendor={1}&amp;vendorKey={2}&amp;base64FileStr={3}&amp;guid={4}&amp;fileName={5}",                                 "kadi", "şifre", "key", encodedFile, guid, strFilename);
  
  
                  string localHttpPostUrl = userGatewayAddress + "uploadFile";
  
                  ASCIIEncoding encoding = new ASCIIEncoding();
  
                  Stream newStream = null;
  
                  HttpWebResponse response = null;
  
                  Stream streamResponse = null;
  
                  StreamReader streamRead = null;
  
  
                 try
  
                  {
  
                      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(localHttpPostUrl);
  
                      request.ContentType = "application/x-www-form-urlencoded";
  
                      request.Method = "POST";
  
  
  
                      byte[] buffer = Encoding.UTF8.GetBytes(postString);
  
                      request.ContentLength = buffer.Length;
  
  
                      newStream = request.GetRequestStream();
  
                      newStream.Write(buffer, 0, buffer.Length);
  
                      newStream.Close();
  
  
                      response = (HttpWebResponse)request.GetResponse();
  
                      streamResponse = response.GetResponseStream();
  
                      streamRead = new StreamReader(streamResponse);
  
  
                      Char[] readBuffer = new Char[256];
  
                      ret = string.Empty;
  
                      int totalCharCount = 0; 
  
                      int count = streamRead.Read(readBuffer, 0, 256);
  
                      while (count &gt; 0)
  
                      {
  
                          totalCharCount += count;
  
                          ret += new String(readBuffer);
  
                          count = streamRead.Read(readBuffer, 0, 256);
  
                      }
  
                      ret = ret.Substring(0, totalCharCount);
  
  
                      return ret;
  
                  }
  
                  catch (Exception x)
  
                  {
  
                      return x.Message;
  
                  }
  </code></pre>