大家好,我有後續的代碼的CookieContainer返回空
Uri site = new Uri("http://www.receita.fazenda.gov.br/pessoajuridica/cnpj/cnpjreva/Cnpjreva_Solicitacao2.asp");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(site);
CookieContainer cookies = new CookieContainer();
request.CookieContainer = cookies;
//Console.WriteLine(cookies.GetCookieHeader(site));
//Get the response and print out the cookies again
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Console.WriteLine(cookies.GetCookieHeader(site));
}
Console.Write("end");
Console.ReadKey();
那麼這段代碼返回cookie確定,但如果我更改URI到http://www8.receita.fazenda.gov.br/SimplesNacional/Aplicacoes/ATBHE/ConsultaOptantes.app/ConsultarOpcao.aspx它無法正確顯示它的返回空
任何人都可以幫助我解決這個問題?
我期望從www到www8的變化意味着你得到一個空的cookie集合。如果您在receita.fazenda.gov.br上設置了可以正常工作的cookie –