I was trying to DirectCast for Json, using the following code -
Dim EmailId as String
Dim URL as String
EmailId = txtEmailId.Text
URL = "http://localhost/json.php?id=" & EmailId
request = DirectCast(URL, HttpWebRequest)
response = DirectCast(request.GetResponse(), HttpWebResponse)
reader = New StreamReader(response.GetResponseStream())
The problem is, the above mentioned method only works if I hard code Email id into URL. e.g DirectCast("http://localhost/json.php?id=abcd@gmail.com", HttpWebRequest)
. When try to get Email id as variable I get following error -
Value of type 'String' cannot be converted to 'System.Net.HttpWebRequest'.
Please help me to make this work.
request = WebRequest.Create(URL)