Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 623937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:08:48+00:00 2026-05-13T19:08:48+00:00

Below is my code (ASP.net web project), but when i debug this asp page

  • 0

Below is my code (ASP.net web project), but when i debug this asp page it takes ages to retrieve the response ? any idea why is this happening ?

and also the providers of the aURl mentioned to use req.connection=”Close” but when i use that throws out an error. (im new to httpwebrequest sigh)

this is the documentation about
connection -This value specifies that
the connection is not to be a
keep-alive connection.

var url = new Uri(@"My URL");
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
    req.KeepAlive = false;      
    req.Method = "POST";
    req.ContentType = "text/xml";
    //This Fails but the documentation asks to use this ??
    //req.Connection = "Close";
     var requestdata = File.ReadAllText(@"D:\request.txt");
    //req.ContentLength = requestdata.Length;
    StreamWriter myWriter = null;
    myWriter = new StreamWriter(req.GetRequestStream());
    myWriter.Write(requestdata);
    HttpWebResponse objResponse = (HttpWebResponse)req.GetResponse();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:08:48+00:00Added an answer on May 13, 2026 at 7:08 pm

    This would happen if you have a slow internet connection, or if the URL is on a slow server.

    However, try closing the request stream, like this:

    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
    
    req.KeepAlive = false;      
    req.Method = "POST";
    req.ContentType = "text/xml";
    
    using(StreamWriter myWriter = new StreamWriter(req.GetRequestStream())
        myWriter.Write(File.ReadAllText(@"D:\request.txt"));
    
    HttpWebResponse objResponse = (HttpWebResponse)req.GetResponse();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my code attached below, I'm trying to upload a file via ASP.NET. I
I'm using MySql in my asp.net project. But I don't want to type every
I am using AspNetSqlMembershipProvider in my ASP .Net 4 web application project. I have
In the below code sample, what does {0:X2} mean? This is from the reflection
I'm building an ASP.Net MVC website. Rather than have everything in one project, I've
Any ideas why I am getting the below error in my MVC2 project, even
Integrating SimpleModal with ASP.NET and MasterPages This is a continuation of a previous thread
I have a generic editor in ASP.NET page for editing lookup values for different
When running the below code a type is never returned, despite there being a
In the below code snippet can i replace char * to const char *

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.