473,850 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

webresponse.clo se hangs.

Hi all,

I am facing very strange problem while using webrequest.

What i am doing is i have one url which i want to validate. so i am
using webrequest and webresponse.

My code is as below:-
Uri myUri =new Uri(urlname);
// Create a new request to the above mentioned URL.
WebRequest myWebRequest= WebRequest.Crea te(myUri);
myWebRequest.Ti meout = 100000;
((HttpWebReques t) myWebRequest).C redentials =
CredentialCache .DefaultCredent ials;
/ Assign the response object of 'WebRequest' to a 'WebResponse'
WebResponse myWebResponse= myWebRequest.Ge tResponse();
MessageBox.Show (myWebResponse. ResponseUri.ToS tring());
myWebResponse.C lose();
MessageBox.Show (myWebResponse. ResponseUri.ToS tring());
catch(Exception expt)
MessageBox.Show (expt.Message);

Here first messagebox is getting displayed properly. But the statement
mywebresponse.c lose hangs.
I am not getting why this is happening.

I tried with same url using asynchronous web request. But of no luck.

Can anyone tell me why this is happening.

Is there any way to set timeout for webresponse?

please help me asap.

thanks in advance.

Nov 21 '06 #1
0 1507

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

Similar topics

by: Jacob | last post by:
Please help figure what I am doing wrong in this code. All I am trying to do is send come data to an aspx page and get some data back. I watched my variable in debug mode and can tell that I am reaching the web site but my data seems not to be posted. Also in debug mode I get error "Remote server returned error 401: Unautherized) at the "WebResponse Response = Request.GetResponse();" line and debugging stops. I have the required certificate...
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the idea that costs nothing and it is inheritently built into the Framework. So here is the solution... When you use the WebRequest and WebResponse classes to obtain graphics from a web site, these classes have built-in decoding for JPEG 2000 files....
by: gizmo | last post by:
Hi, I'm using the following code to request the html source from the quoted site. ...... string url = "http://www1.soccerstand.com/"; WebRequest webRequest = WebRequest.Create(url); WebResponse webResponse = webRequest.GetResponse(); beginStr = new StreamReader(webResponse.GetResponseStream(),
by: trialproduct2004 | last post by:
Hi all. i am having problem at a time of validatiang url. I am using webrequest and webresponse class to get content of particular url. My problem is after using webrequest and webresponse class i want to remove memory allocated by this object. am using close method and after that i am setting it to null. My pronlem is that at a time of setting webrequest to null sometimes it is taking more than 10 minutes. similary at a time of closing...
by: trialproduct2004 | last post by:
hi all can some one tell me how to call dispose method of webresponse. I am currently using close method. But this is creating problem. So i want to use dispose method of webresponse. Can some one tell me how to do this. Any help will be appreciated. thanks in advance.
by: Mamatha | last post by:
Hi I have developed one application in VB.NET which extracts the source code of Web pages.I gave a bunch of URLs in a listbox while at the time of response from the web it was struckup.Sometimes it gives output but sometimes it was struckup,i don't know the reason why it was strucked. If u know please let me know.Here it my source code.
by: Mr Flibble | last post by:
OK I logon to a web site and I manage to get an SMSESSION cookie that I then store in a variable called _session (a class scoping variable). I do this by calling a logon URL and setting a cookie to SMCHALLANGE=YES to allow me to obtain a session. I then iterate the cookie collection to extract the SMSESSION value. All is good (so far). This is when the sky turns grey and the rain starts to fall. I then use this SMSESSION in a web...
by: KyleUbenk | last post by:
Well I have a multi-threaded program which downloads URL sources from the web. Im doing this multiple times at once. The only problem I see is that sometimes it takes a while to download the sourceWebResponse ServerResponse = webrequest.GetResponse(); and only one webresponse can happen at once because the rest of the threads seem to wait on the first webresponse to finish. Is there a way around this? I hope you understand what my problem is. ...
by: CindyH | last post by:
Hi I'm trying to use webrequest - webresponse to post a stream. I have set up a simple test with one aspx form holding the post code and trying to get another aspx form to receive the post on localhost. Can you explain to me the possible reasons why a 'GetResponse' - to send the data to a server might not be working for a simple text file with one line. test.text - contains: this is a test.
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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,...
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...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.