Here I will explain how to rotate a image. public void FlipImage(string Filename, string NewFileName) { System.Drawing.Image img = System.Drawing.Image.FromFile(System.Web.Hosting.HostingEnvironment.MapPath("/images/") + Filename); //Rotate the image in memory img.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipNone); System.IO.File.Delete(System.Web.Hosting.HostingEnvironment.MapPath("/images/" + NewFileName)); //save the image out to the file img.Save(System.Web.Hosting.HostingEnvironment.MapPath("/images/" + NewFileName)); //release image file img.Dispose(); }
Here you can find solution of your code problem & errors.