Custom Search
Logiclabz
  • Home
  • C#
  • Convert byte[] to string in .Net C#

Convert byte[] to string in .Net C#

  

System.Net.WebClient webdata = new System.Net.WebClient();
string sampleurl = "http://www.sampleurl.com/default.htm";

//the below statement assigns byte[]
byte[] bytes = webdata.DownloadData(sampleurl);

//the below code converts byte[] type string type
string txt = System.Text.Encoding.GetEncoding("utf-8").GetString(bytes);



  


Leave a reply




Do you like this post?