private string processDropIdresponse(HttpWebResponse response) { StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8); string sourceCode = sr.ReadToEnd(); HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); htmlDocument.LoadHtml(sourceCode); HtmlNode routeList = htmlDocument.GetElementbyId("DropDownListDrop"); string jqueryText = routeList.NextSibling.InnerHtml; System.Text.RegularExpressions.Match jobjectString = System.Text.RegularExpressions.Regex.Match(jqueryText, @"\[{.*}\]"); Newtonsoft.Json.Linq.JArray jarray = Newtonsoft.Json.Linq.JArray.Parse(jobjectString.Value); var routeToken = jarray.First(c => c["Name"].ToString().Contains(dropLocationName)); return((routeToken.First(c => { return (c as Newtonsoft.Json.Linq.JProperty).Name == "ID"; }) as Newtonsoft.Json.Linq.JProperty).Value.ToString()); }