我創建的PHP頁面與這些Cookie:在C#中讀取Cookie的
setcookie("0","hello+how+are+you",time()+30);
在C#中我寫的代碼讀取餅乾:
string webaddr = "http://www.mywebsite.com";
string cookiesresult = "";
//----Establish Connection to web and get cookies [Commands]----//
HttpWebRequest httpwr = (HttpWebRequest)WebRequest.Create(webaddr);
httpwr.CookieContainer = new CookieContainer();
HttpWebResponse httpwrs = (HttpWebResponse)httpwr.GetResponse();
//----Start Getting Cookies----//
foreach (Cookie cook in httpwrs.Cookies)
{
cookiesresult = cook.Value;
}
Console.WriteLine("Cookies Recieved : " + cookiesresult);
現在的cookie值應該是:你好+如何是+你 而是值爲:你好%2Bhowo%2areo%2you
所以交換+與鄰%2,我不`噸知道是什麼問題
它應該用'%2B'替換'+'。 – Greg