コード例 #1
0
        // Methods
        public static void PerformRequest(Uri uri, CookieContainer cookies)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
            request.CookieContainer = cookies;

            request.Timeout = 200;
            RequestState rs = new RequestState();
            rs.Request = request;
            IAsyncResult r = request.BeginGetResponse(new AsyncCallback(WebRequestInSameSession.RespCallback), rs);
            allDone.WaitOne();
        }
コード例 #2
0
        public static void PerformRequest(Uri uri, CookieContainer cookieContainer)
        {
            // Create the request object.
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
            if (cookieContainer != null)
                request.CookieContainer = cookieContainer;

            request.Timeout = 200;

            // Create the state object.
            RequestState rs = new RequestState();

            // Put the request into the state object so it can be passed around.
            rs.Request = request;

            // Issue the async request.
            IAsyncResult r = (IAsyncResult)request.BeginGetResponse(
               new AsyncCallback(RespCallback), rs);

            // Wait until the ManualResetEvent is set so that the application
            // does not exit until after the callback is called.
            allDone.WaitOne();
        }