Using WebRequest... what the heck is wrong?
public void Submit()
{
string postElements = "?x_login=" + _login
+ etc...;
WebRequest request =
WebRequest.Create("https://secure.authorize.net/gateway/transact.dll"
+ postElements);
request.Method = "POST";
request.Timeout = 60000;
WebResponse response = request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream());
string result = sr.ReadToEnd();
sr.Close();
response.Close();
_rawResult = result;
string[] results = result.Split(new char[] {'|'});
if (results[0] == "1") _approved = true;
_errorText = results[3];
_avs = results[5];
_transactionID = results[6];
}
This works great from a unit test that calls it something like this:
Transaction t = new Transaction();
t.Address = "3412 Beaumont Dr.";
etc...
t.Submit();
But when I try to use the exact same code in my Web app, it ALWAYS times out on the request.GetResponse() call. What gives? How is that possible? It times out both on my own box (the one that runs the unit test fine) and on my production server.