I'm trying to get the value from a XHR e.g. http://www.mypage.com/step/make/validateuser.php?user=test456&password=test123.
I was testing with HttpWebResponse and other ways that I find here, but without success. The code below was the last tested, and don't return the string text expected by the link XHR.
{
// TODO: Add your code here
var request = (HttpWebRequest)WebRequest.Create(@"http://www.mypage.com/step/make/validateuser.php?user=test456&password=test123");
var response = (HttpWebResponse)request.GetResponse();
string responseString;
using (var stream = response.GetResponseStream())
{
using (var reader = new StreamReader(stream))
{
responseString = reader.ReadToEnd();
MessageBox.Show(responseString);
}
}
Dts.TaskResult = (int)ScriptResults.Success;
}```
I'm not a fan of the MessageBox.Show()
. It would be much better to set a breakpoint and step through it to see the value of responseString, reader, and response while it is running.