Hi All,
i try to save youtube thumnail image in my local pc by asp.net c# application. some of them are saving my pc. but some of them are not saving. why.?
saving images
http://img.youtube.com/vi/8xthEGaywuk/1.jpg
http://img.youtube.com/vi/jh-PnSxVFSI/1.jpg
http://img.youtube.com/vi/8OYf79iu2VI/1.jpg
not saving images
http://img.youtube.com/vi/OMjAWg63ZKY/1.jpg
http://img.youtube.com/vi/YmzQccIEef4/1.jpg
below i giving my c# code
a = a + 1;
string connection = System.Configuration.ConfigurationManager.ConnectionStrings["TenantDataConnection"].ConnectionString.ToString();
SqlConnection conn = new SqlConnection(connection);
SqlCommand cmd;
cmd = new SqlCommand("ConvertImage", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
//cmd.Parameters.Add("@imageconvert",System.Data.SqlDbType.Int,1,"1");
if (a == 6) { a = 7; }
SqlParameter tblvaluetype = cmd.Parameters.AddWithValue("@imageconvert", a);
tblvaluetype.SqlDbType = System.Data.SqlDbType.Int;
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
string value = dr[0].ToString();
//string value2 = dr[1].ToString();
conn.Close();
string[] value3 = null;
value3 = value.Split('/');
string remoteUri = value;
string fileName = value3[5], myStringWebResource = null;
string filepathis = @"D:\Binu\Images\" + value3[4] + fileName;
WebClient myWebClient = new WebClient();
myStringWebResource = remoteUri;
myWebClient.DownloadFile(myStringWebResource, filepathis);