title: Upload from IOS picture to .net app: Rotate
body: <p>I have below code for uploading and resize pictures from IOS Devices to my .net application. Users use to take picture in portrait orientation and then all pictures show up in my app with wrong rotation. Any suggestion how to fix this?</p>
  
  <pre><code>            string fileName = Server.HtmlEncode(FileUploadFormbilde.FileName);
              string extension = System.IO.Path.GetExtension(fileName);
              System.Drawing.Image image_file = System.Drawing.Image.FromStream(FileUploadFormbilde.PostedFile.InputStream);
              int image_height = image_file.Height;
              int image_width = image_file.Width;
              int max_height = 300;
              int max_width = 300;
  
              image_height = (image_height * max_width) / image_width;
              image_width = max_width;
  
              if (image_height &gt; max_height)
              {
                  image_width = (image_width * max_height) / image_height;
                  image_height = max_height;
              }
  
              Bitmap bitmap_file = new Bitmap(image_file, image_width, image_height);
              System.IO.MemoryStream stream = new System.IO.MemoryStream();
  
              bitmap_file.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
              stream.Position = 0;
  
              byte[] data = new byte[stream.Length + 1];
              stream.Read(data, 0, data.Length);
  </code></pre>