- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
public static string Get(this HttpWebRequest req)
{
string res;
string ErrorCode="";
try
{
ErrorCode = "100";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "101";
Stream dataStream = response.GetResponseStream();
ErrorCode = "102";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "103";
res = sr.ReadToEnd();
ErrorCode = "104";
}
catch
{
try
{
ErrorCode = "105";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse) req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "106";
Stream dataStream = response.GetResponseStream();
ErrorCode = "107";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "108";
res = sr.ReadToEnd();
ErrorCode = "109";
}
catch
{
try
{
ErrorCode = "110";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "111";
Stream dataStream = response.GetResponseStream();
ErrorCode = "112";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "113";
res = sr.ReadToEnd();
ErrorCode = "114";
}
catch
{
res = "Error doing get to " + req.RequestUri.AbsoluteUri + " ErrorCode: " + ErrorCode;
}
}
}
return res;
}