Hi
void Connect()
{
try
{
ST = new WebClient().DownloadString(first_adress + "servermodule/pass.php?sno=" + servno).ToString();
}
catch (System.Exception)
{
try
{
ST = new WebClient().DownloadString(second_adress + "servermodule/pass.php?sno=" + servno).ToString();
}
catch (System.Exception)
{
if (ST == "")
{
DateTime dt = DateTime.Now;
string c = string.Format("{0:d/M/yyyy HH:mm:ss}", dt);
label5.Text = "Error!" + " " + c;
error= true;
}
else
{
error = false;
}
}
}
}
I'm using this code to connect to my server and take some values.If main server is not accessible then use back up server to take values.
So are there any better code to use?
I mean if I want to add another back up server what should i do?
I'm planning to use another try - catch block but there must be a better way.
Thank you for help.