title: Convert session value into Byte[]
body: <p>I store image into session in base64 format,
  how can I convert it into byte[]</p>
  
  <p>I want to do something like this:</p>
  
  <pre><code>Byte[] bytes =(Byte[]) Session["picimg"];
  </code></pre>
  
  <p>it's not working.</p>
  
  <p>This is my code:</p>
  
  <pre><code>StreamReader reader = new StreamReader(Request.InputStream); 
  String Data = Server.UrlDecode(reader.ReadToEnd());
  reader.Close();
   DateTime nm = DateTime.Now;
  string date = nm.ToString("yyyymmddMMss");
          //used date for creating Unique image name
  
  Session["capturedImageURL"] = Server.MapPath("Userimages/") + date + ".jpeg";
  
  Session["Imagename"] = date + ".jpeg";
  // We can use name of image where ever we required that why we are storing in Session
  
          drawimg(Data.Replace("imgBase64=data:image/png;base64,", String.Empty), Session["capturedImageURL"].ToString());
  
          // it is method 
          // passing base64 string and string filename to Draw Image.
   Session["picimg"] = (Data.Replace("imgBase64=data:image/png;base64,", String.Empty));
  
          Byte[] bytes =(Byte[]) Session["picimg"];
          System.IO.File.WriteAllBytes(@"Userimages", bytes);
  </code></pre>