Home > DeveloperSection > Forums > do httpwebrequest but without waiting for response
Jeet Verma
Jeet Verma

Total Post:110

Points:776
Posted on    August-29-2014 1:19 AM

 ASP.Net
Ratings:


 1 Reply(s)
 1068  View(s)
Rate this:

I do not want to wait for response from server because i do not care about response for these httpwebrequest.

HttpWebRequest PostRequest = (HttpWebRequest)WebRequest.Create(PostUrl);

        PostRequest.ContentType = PostContentType;

        PostRequest.Method = "POST";

        byte[] bytes = Encoding.ASCII.GetBytes(DataUrl);           

        try

        {

            PostRequest.ContentLength = bytes.Length;

            using (Stream webpageStream = PostRequest.GetRequestStream())

            {

                webpageStream.Write(bytes, 0, bytes.Length);

            }

        }

        catch (Exception ex)

        {

            //

        }

Thanks



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    September-01-2014 12:22 AM

try this:

webpageStream.Flush();

 webpageStream.Close();


Don't want to miss updates? Please click the below button!

Follow MindStick