I am writing this code to get url from database but is showing error how to fix it?
static string SendSMS(string msg, string receipietnt, string mask)
{
con = new SqlDbConnect();
con.SqlQuery("select Link,AKey,UserName,Password from tblSMSSetup");
con.RdrEx();
if (con.Rdr.Read())
{
string link = con.Rdr["Link"].ToString();
string key = con.Rdr["AKey"].ToString();
string userName = con.Rdr["UserName"].ToString();
string password = con.Rdr["Password"].ToString();
string download = "";
try
{
string apipart1 = string.Format("http://api.smssky.pk/api-send-branded-sms.aspx?username={0}&pass={1}", userName, password);
string apipart2 = "&text=";
string apipart3 = "&masking=";
string apipart4 = "&destinationnum=";
System.Net.WebClient myWebClient;
myWebClient = new System.Net.WebClient();
download = myWebClient.DownloadString(apipart1 + apipart2 + msg + apipart3 + mask + apipart4 + receipietnt + "&language=English");
int st = download.IndexOf("<span id=\"lblmessage\">");
int end = download.LastIndexOf("</span>");
download = download.Substring(st, end - st);
download = download.Replace("<span id=\"lblmessage\">", "");
download = download.Trim();
download = download.TrimEnd();
}
catch (Exception ex)
{
download = ex.Message;
}
return download;
}
con.Rdr.Close();
con.conClose();
}