我發送獲取請求的網站,並根據我必須做smthng的迴應。開關櫃實現
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://www.site.ru/sfdcsfs/");
req.AllowAutoRedirect = false;
req.Method = "GET";
req.CookieContainer = cookies;
req.UserAgent = "Opera/9.80 (Windows 7; U; en) Presto/2.9.168 Version/11.50";
req.ContentType = "application/x-www-form-urlencoded";
res1 = (HttpWebResponse)req.GetResponse();
res1.Close();
switch (res1)
{
case res1.Headers["XcT"]: log("[+] ok");
case res1.Headers["Location"].Contains("alreadymember"): log("[-] alreadymember");
default: log("[-] bad");
}
但我有錯誤
Error 1 A switch expression or case label must be a bool, char, string, integral, enum, or corresponding nullable type C:\Users\asus\documents\visual studio 2010\Projects\OdGP\OdGP\Form1.cs 195 29 OdGP
它是什麼您不明白有關錯誤消息? –
只有一種情況的switch語句?爲什麼不使用'if/else'? –
更新代碼 – user1870480