当前位置: 首页>>代码示例>>C#>>正文


C# HttpWebRequest.BeginGetRequestStream方法代码示例

本文整理汇总了C#中System.Net.HttpWebRequest.BeginGetRequestStream方法的典型用法代码示例。如果您正苦于以下问题:C# HttpWebRequest.BeginGetRequestStream方法的具体用法?C# HttpWebRequest.BeginGetRequestStream怎么用?C# HttpWebRequest.BeginGetRequestStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.HttpWebRequest的用法示例。


在下文中一共展示了HttpWebRequest.BeginGetRequestStream方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PostRegisterInfoAsync

 public void PostRegisterInfoAsync(RegisterInfo registerInfo)
 {
     _requestState = new RequestState();
     _registerInfo = registerInfo;
     _httpWebRequest = (HttpWebRequest)WebRequest.Create(_registerURL);
     _timer.Start();
     _requestState.request = _httpWebRequest;
     _httpWebRequest.Method = "POST";
     _httpWebRequest.ContentType = "application/x-www-form-urlencoded";
     _httpWebRequest.BeginGetRequestStream(new AsyncCallback(RequestCallback), _httpWebRequest);
 }
开发者ID:uvbs,项目名称:MyProjects,代码行数:11,代码来源:RegisterFactory.cs

示例2: GetRequestStreamAsynch

 private Stream GetRequestStreamAsynch(HttpWebRequest request)
 {
     return AsynchHelper.WaitForAsynchResponse(
         c => request.BeginGetRequestStream(c, null),
         (r, s) => request.EndGetRequestStream(r)
     );
 }
开发者ID:sergioazevedo,项目名称:restfulie-net,代码行数:7,代码来源:DefaultRequestDispatcher.cs

示例3: Submit

 public void Submit()
 {
     // Prepare web request...
     webRequest = WebRequest.CreateHttp(url);
     webRequest.Method = "POST";
     webRequest.ContentType = string.Format("multipart/form-data; boundary={0}", boundary);
     webRequest.BeginGetRequestStream(new AsyncCallback(RequestReady), webRequest);
 }
开发者ID:appgranula,项目名称:vk_metro,代码行数:8,代码来源:PostSubmitter.cs

示例4: BeginRequest

 private void BeginRequest(string method, HttpWebRequest httpRequest, AsyncRequest rawRequestData)
 {
     if (method == "PUT" || method == "POST")
     {
         httpRequest.BeginGetRequestStream(WriteStream, rawRequestData);
     }
     else
     {
         httpRequest.BeginGetResponse(ReadCallback, rawRequestData);
     }
 }
开发者ID:RJacksonm1,项目名称:JustGiving.Api.Sdk,代码行数:11,代码来源:SilverlightHttpClient.cs

示例5: POST

 protected void POST(string URL, string post_message)
 {
     POST_REQUEST = (HttpWebRequest)HttpWebRequest.Create(URL);
     POST_REQUEST.Method = "POST";
     POST_REQUEST.ContentType = "application/x-www-form-urlencoded";
     POST_REQUEST.BeginGetRequestStream(result =>
     {
         Stream post_stream = POST_REQUEST.EndGetRequestStream(result);
         byte[] ba = Encoding.UTF8.GetBytes(post_message);
         post_stream.Write(ba, 0, ba.Length);
         post_stream.Close();
         POST_REQUEST.BeginGetResponse(new AsyncCallback(POST_Method_CallBack),POST_REQUEST);
     }, POST_REQUEST);
 }
开发者ID:ahmeda8,项目名称:audio-youtube-wp7,代码行数:14,代码来源:WebMethods.cs

示例6: WebRequestResult

        public WebRequestResult(HttpWebRequest pRequest, ProxyTranslation pTranslation, AsyncCallback pCallback, HttpContext pContext, object pState)
        {
            context = pContext;
            _request = pRequest;
            _callback = pCallback;
            translation = pTranslation;
            IsCompleted = false;
            AsyncState = pState;

            if (_request.Method.Equals("POST", StringComparison.InvariantCultureIgnoreCase))
                _request.BeginGetRequestStream(new AsyncCallback(AsyncReturnStream), this);
            else
                _request.BeginGetResponse(new AsyncCallback(AsyncReturn), this);
        }
开发者ID:kasthor,项目名称:ReverseProxy,代码行数:14,代码来源:WebRequestResult.cs

示例7: GetWebRequest

            protected override WebRequest GetWebRequest(Uri address) {
                  string a = address.ToString();
                  string[] words = a.Split(new Char[] { '?' });
                  _webRequest = (HttpWebRequest)System.Net.WebRequest.Create(new Uri(words[0], UriKind.RelativeOrAbsolute));
                  _webRequest.CookieContainer = App.CookieContainer;
                  _webRequest.Headers["Cache-Control"] = "no-cache";
                  _webRequest.Headers["User-Agent"] = Global.GetDeviceOSVersion();
                  _webRequest.Method = "POST";
                  _webRequest.Headers["token"] = this._token;
                  _webRequest.ContentType = "application/x-www-form-urlencoded; charset=ISO-8859-1";
                  _postId = words[1];
                  _webRequest.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), _webRequest);
                  System.Threading.Thread.Sleep(1000);

                  return _webRequest;
            }
开发者ID:jfrausto914,项目名称:FSW,代码行数:16,代码来源:CustomWebClient2.cs

示例8: run

        public void run()
        {
            _asyncState = new ManualResetEvent(false);

            // create a new request
            _request = (HttpWebRequest) WebRequest.Create(_url);
            _request.Method = "POST";
            _request.Accept = "application/json";
            _request.ContentType = _contentType;

            if (_request.Method == "POST")
                // Start the asynchronous operation to get the request-content
                _request.BeginGetRequestStream(new AsyncCallback(getRequestCallback), _request);
            else
                // Start the asynchronous operation to get the response
                _request.BeginGetResponse(new AsyncCallback(getResponseCallback), _request);
        }
开发者ID:pdiegmann,项目名称:net-reaktor,代码行数:17,代码来源:reaktorRequest.cs

示例9: Run

 public void Run()
 {
     try
     {
         string postString = string.Format("assertion={0}&audience={1}", HttpUtility.UrlEncode(Assertion), HttpUtility.UrlEncode(Audience));
         PostBytes = Encoding.ASCII.GetBytes(postString);
         Request = (HttpWebRequest)HttpWebRequest.Create("https://verifier.login.persona.org/verify");
         Request.UserAgent = "Persona Client";
         Request.Method = "POST";
         Request.ContentType = "application/x-www-form-urlencoded";
         Request.ContentLength = PostBytes.Length;
         Request.BeginGetRequestStream(new AsyncCallback(OnGetRequestStream), null);
     }
     catch (Exception exception)
     {
         HandleException(exception);
     }
 }
开发者ID:epicvrvs,项目名称:Voiddekk,代码行数:18,代码来源:PersonaClient.cs

示例10: GetRequestStreamAsync

 public static Task<Stream> GetRequestStreamAsync(HttpWebRequest request)
 {
     var taskComplete = new TaskCompletionSource<Stream>();
     request.BeginGetRequestStream(asyncResponse =>
     {
         try
         {
             HttpWebRequest responseRequest = (HttpWebRequest)asyncResponse.AsyncState;
             Stream someResponse = (Stream)responseRequest.EndGetRequestStream(asyncResponse);
             taskComplete.TrySetResult(someResponse);
         }
         catch (Exception)
         {
             taskComplete.TrySetResult(null);
         }
     }, request);
     return taskComplete.Task;
 }
开发者ID:Synergex,项目名称:Baconography,代码行数:18,代码来源:TinyRedditService.cs

示例11: HtttpPost

        private void HtttpPost()
        {
            try
            {
                request = (HttpWebRequest)HttpWebRequest.Create("http://dldir1.qq.com/qqfile/qq/QQ2013/2013Beta5/6970/QQ2013Beta5.exe");
                //Thread.Sleep(1000);
                request.Method = "POST";
                request.BeginGetRequestStream(ResponseStreamCallbackPost, request);
                //request.BeginGetResponse(ResponseCallbackPost, request);
            }
            catch (WebException e)
            {
                if (e.Status == WebExceptionStatus.Timeout)
                {

                }
                Dispatcher.BeginInvoke(() => MessageBox.Show(e.Message + " Status:" + e.Status));
            }
        }
开发者ID:peepo3663,项目名称:WindowsPhone8,代码行数:19,代码来源:Page1.xaml.cs

示例12: DoPost

 protected void DoPost(string url, string post, Action<string> doOnFinish)
 {
     try
     {
         myRequest = HttpWebRequest.CreateHttp(url);
         myRequest.Accept = "application/json";
         myRequest.Method = "POST";
         myRequest.ContentType = "application/x-www-form-urlencoded";
         myRequest.CookieContainer = cookieContainer;
         var async1 = myRequest.BeginGetRequestStream((result1) =>
         {
             HandleEndGetRequestStream(post, doOnFinish, result1);
         },
             null);
     }
     catch (Exception exc)
     {
         ShowErrorMessage(exc);
     }
 }
开发者ID:slodge,项目名称:main,代码行数:20,代码来源:ScriptUploader.cs

示例13: DownloadStringAsyncWithPost

        public void DownloadStringAsyncWithPost(HttpWebRequest request, byte[] postData, string contentType)
        {
            _webRequest = request;
            _webRequest.Method = "POST";
            _webRequest.ContentType = contentType;
            _webRequest.AllowReadStreamBuffering = true;

            try
            {
                _webRequest.BeginGetRequestStream(BeginRequest, postData);
            }
            catch (SystemException)
            {
                // Bad news bears.
            }

#if DEBUG && TRACKING_TIME
            StartTimeTracking();
#endif
        }
开发者ID:TediWang,项目名称:4thandmayor-ancient,代码行数:20,代码来源:LegacyWebRequestClient.cs

示例14: PhoneApplicationPage_Loaded

 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
 {
    
     //myRequest = (HttpWebRequest)WebRequest.Create("http://passport.cnblogs.com/login.aspx");
     if (NavigationContext.QueryString.Count > 0) {
         username = NavigationContext.QueryString["username"];
         password = NavigationContext.QueryString["password"];
     
     }
     myRequest = (HttpWebRequest)WebRequest.Create("http://m.cnblogs.com/mobileLoginPost.aspx");
     myRequest.Method = "POST";
     myRequest.ContentType = "application/x-www-form-urlencoded";
     if (cookieContainer==null)
     {
         myRequest.CookieContainer = new CookieContainer();
     }
     myRequest.CookieContainer = cookieContainer;
     
     myRequest.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), myRequest);
     getFlashMemoryList();
     
 }
开发者ID:shandowsoftware,项目名称:cnblogs-wpapp,代码行数:22,代码来源:flashMemory.xaml.cs

示例15: PostImage

    /// <summary>
    /// Post image
    /// </summary>
    /// <param name="url"></param>
    /// <param name="data"></param>
    /// <param name="imgRaw"></param>
    public void PostImage(
                  string url,
                  Dictionary<string, object> data,
                  WebPostImageObject media)
    {
      byte[] postData = BuildImagePostData(data, media);

      try
      {
        Request = HttpWebRequest.Create(url) as HttpWebRequest;
        Request.ContentType =
                  string.Concat("multipart/form-data; boundary=",
                                BOUNDARY);
        Request.Method = "POST";
        Request.BeginGetRequestStream(
            (asyncResult) => OnGetRequestStreamCallback(asyncResult, postData),
           Request);
      }
      catch (System.Exception e)
      {
        FirePostFailedEvent(e);
        CleanUp();
      }
    }
开发者ID:popopome,项目名称:memocloud,代码行数:30,代码来源:WebPost.cs


注:本文中的System.Net.HttpWebRequest.BeginGetRequestStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。