how to execute several urls from database
Hi ....i have a problem that I have more than 1000 urls in my database with a corresponding code in other column.I have to make it execute every url one by one using c# and then get response from every url and set the time for every url to run and give response ......so if url is invalid its code gets stored in some variable. kindly provide me complete code I am a new bee beginner
Joginder BangerPosted Dec 19, 2014, 5:38 AM
I assume you have 10 url in datatable.
for(int i=1;i<=datatbale.rows.length;i++)
{
if(test(dt.rows[i].tostring())==true)
{
dt.rows["columnname"][i]=1;
}
}
public bool test(string Url)
{
WebRequest webRequest = WebRequest.Create(Url);
WebResponse webResponse;
try
{
webResponse = webRequest.GetResponse();
}
catch //If exception thrown then couldn't get response from address
{
return false;
}
return true;
}