English 中文(简体)
从吉大港山区应对方案获得库克群岛
原标题:Getting Cookies from HTTP response

我在从吉大港山区的对策中看到 co。 当然,这种反应应该有条不紊,但我可以看一看。

我的守则是:

    private static CookieContainer cookies = new CookieContainer();
    private static CookieContainer Cookies
    {
        get
        {
            return cookies;
        }
    }

    public static async Task<HttpStatusCode> SendPostRequest(string url, string postData)
    {
        if (url == null)
            throw new ArgumentNullException("url");

        if (postData == null)
            throw new ArgumentNullException("postData");

        HttpStatusCode statusCodeToReturn = HttpStatusCode.Forbidden;
        HttpWebRequest webRequest = HttpWebRequest.CreateHttp(url);
        webRequest.Method = "POST";
        var cookies = Cookies;
        webRequest.CookieContainer = cookies;
        //webRequest.SupportsCookieContainer = true;
        using (var requestStream = await webRequest.GetRequestStreamAsync())
        {
            var bytes = Encoding.UTF8.GetBytes(postData);
            requestStream.Write(bytes, 0, bytes.Length);
        }

        using (WebResponse response = await webRequest.GetResponseAsync())
        {
            statusCodeToReturn = WebResponseToHTTPStatusCode(response);
        }

        return statusCodeToReturn;
    }

库克群岛(使用电线):

rack.session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRiJFMzg1ZjYxNzIzNzQ4MmY5NmI3NTMw%0AYWMwZmRjNmVmZjMwMDk4OTgzZGUwNjRlNzIzODlmODNjYzE2YmVmMjNlOQ%3D%3D%0A--30d79cd2276c3236de11104852bba4b84bf80f26; path=/; HttpOnly
最佳回答

问题在于返回的库克群岛。 没有配制的库克群岛是第7号工作计划支持的NOT。

问题回答

我认为,你只能创造全球变量,以拯救 co。 如您的xaml.cs文件所示,你可以产生这样的变化:

public CookieContainer GlobalCookie{get;set;}

使GloalCookie与你成功的HttpWebRequest CookieContainer一样。

Then you can use this variable when you call another API.Hope to help you:)





相关问题
How to suppress/remove PHP session cookie

I need to suppress an already set session cookie header, but I cannot find any way to do this. Why? I need to make an image, sent by a PHP script, cacheable by the end user; this image is used to ...

Remove Cookies from JS or CSS files

Bizarrely my javascript and css files have cookies (says Firebug). I use Zend Framework and I think it has to do with it. Could I change the .htaccess that CSS or JS files don t link to the ZF or is ...

httplib2, how to set more than one cookie?

As you are probably aware, more often than not, an HTTP server will send more than just a session_id cookie; however, httplib2 handles cookies with a dictionary, like this: response, content = http....

cookies control

what tool wold you recommend me to use in order to see what data are stored in my cookies while i m browsing the net. I m a beginner into webdev field(6 months php experience) and i m curious to see ...

热门标签