title: How to Convert Base64 string To Video in C#
body: <p>I'm trying to convert a  <code>base64</code> string to video In C#, and save it in the <em>App_Data/Video/Film</em> folder . It's not working. </p>
  
  <p>Code: </p>
  
  <pre><code>public void ConvertToVideo(string data)
      {
          byte[] ret = Convert.FromBase64String(data);
          string date = DateTime.Now.ToString().Replace(@"/", @"_").Replace(@":", @"_").Replace(@" ", @"_");
          string path = HttpContext.Current.Server.MapPath("~/App_Data/Video/Film");
          FileInfo fil = new FileInfo(path+date+".mp4");
          using (Stream sw = fil.OpenWrite())
          {
              sw.Write(ret, 0, ret.Length);
              sw.Close();
          }
      }
  </code></pre>
  
  <p>Error: The input is not a valid Base-64 String as it contain...</p>
  
  <p><a href="https://i.stack.imgur.com/VDj81.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VDj81.png" alt="Error When Convert Base64 To Video"></a></p>