473,671 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetResponse() timeout

I am trying to get the following code to work :

HttpWebRequest request1 = (HttpWebRequest )
WebRequest.Crea te(@"http://localhost/TacUssd/8.tac");
request1.Method = "POST";
request1.Creden tials = System.Net.Cred entialCache.Def aultCredentials ;
request1.Conten tType = "applicatio n/x-www-form-urlencoded";
//Stream stream = request1.GetReq uestStream();
//Stream sr = File.Open(@"D:\ My Documents\Visua l Studio
Projects\ussd\t est.xml", FileMode.Open);
//byte[] bits = new byte[sr.Length];
//sr.Read(bits, 0, bits.Length);
//stream.Write(bi ts, 0, bits.Length);

//request1.Timeou t = 1000;
HttpWebResponse response1 = (HttpWebRespons e) request1.GetRes ponse();

Stream stream1 = response1.GetRe sponseStream();
StreamReader reader1 = new StreamReader(st ream1, Encoding.UTF8);
string text1 = reader1.ReadToE nd();
stream1.Close() ;
response1.Close ();

but I keep get timeouts.

does anyone have any suggestions on this.
I can get it to work fine with "GET", but not with POST.

Thanks in advance
Nov 12 '05 #1
0 1448

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6141
by: Jonathan | last post by:
Calling the System.Net.WebResponse.GetResponse method (see code below) results in the following error: System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. at(System.Net.HttpWebRequest.CheckFinalStatus()) at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at(System.Net.HttpWebRequest.GetResponse())
5
35978
by: Nathan | last post by:
This is a copy of a message at microsoft.public.dotnet.framework.clr: THE CODE: I'm using an HttpWebResponse object to send an HTTP POST to a Java server I have written and are running on the same machine (for dev and testing). Here is the C# code snippet: 1 string clientAddr = "http://127.0.0.1:22225/"; 2 try 3 { 4 webreq = (HttpWebRequest)WebRequest.Create( clientAddr );
1
3429
by: Jason Manfield | last post by:
I have the following URL: http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=/netahtml/search-adv.htm&r=2&p=1&f=G&l=50&d=ptxt&S1=((teeth+OR+member)+OR+provide)&OS=+(teeth+OR+member)+OR+provide&RS=((teeth+OR+member)+OR+provide) Accessing it with the following code snippet (which works for other sites): HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); ...
1
12587
by: Jeff B | last post by:
I'm trying to create a simple screen scraping application and I kept getting a System.Net.WebException thrown back with a message of "The operation has timed-out." At first I thought it was some kind of connectivity issue on the machine. It didn't make sense though, because I can open up a browser on the same machine and easily browse the web. I'm stumped. I looked over my code for any errors and just couldn't find what I was doing...
5
5864
by: japslam japslam via DotNetMonster.com | last post by:
Hi all, I have problem when I use HttpWebRequest and take long time to call to my service server. If at that time there are many request comes in semultaneous, I will get this exception System.Net.WebException: The underlying connection was closed: The request was canceled. ---> System.IO.IOException: Unable to read data from the transport connection. ---> System.ObjectDisposedException: Cannot access a disposed object named...
2
4881
by: microdevsolutions | last post by:
Hello I've seen examples to read a file from somewhere into a HttpWebRequest object then write it to a HttpWebResponse object then stream it into a Stream object, very similar to the following code snipet :- ============================================== Uri uri = new Uri("http://www.somewhere/pdf/image1.pdf"); HttpWebRequest httpRequest = null;
4
1649
by: cj | last post by:
VB 2003 I have a programs that accepts TCPIP requests and processes them. A thread is created to handle each TCPIP connection. Part of handling the request is involves making a webrequest. webReq = Net.HttpWebRequest.Create(URL) webReq.Timeout = 60000 webResp = webReq.GetResponse This has been working fine for 6 months or more handling maybe 50
5
4869
by: mr.newsgroupguy | last post by:
I am working in C# .NET 1.1. My app has a button on its main form that checks to see if it has access to a file on our server, just an XML file. On our server we are running W2K IIS with a virtual directory, set to Windows Authentication. I am creating an HTTPWebRequest object on the client, and setting its Credentials to CredentialCache.DefaultCredentials. Also, I have tried numerous Timeout settings, but they have not made a...
2
6256
by: namit101 | last post by:
When I create an HttpWebRequest, it seems to have the right uri to access the website (with the GET variables there too). But as soon as I run request.GetResponse() the URL changes such that it no longer includes the GET variables and it uses that new uri for accessing the server. Anyone know what might be the problem? string url = "http://internal.company.com?var1=x&var2=y"; HttpWebRequest request =...
0
8474
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8392
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8669
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.