473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Retrieving modified date from a URL. (Ensuring the connection is closed).

Tao
I'm using the following code in my service to retrieve the modified date of
a web page.

public DateTime GetUrlSourceLastModified(string sUri)
{
if(!sUri.ToLower().StartsWith("http://"))
sUri = "http://" + sUri;
Uri uriObj = new Uri(sUri);
HttpWebRequest request =
(HttpWebRequest)WebRequest.CreateDefault(uriObj);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
DateTime d = response.LastModified;
response = null;
request = null;
return d;
}

The code above works, however I've noticed via monitoring my firewall that
when this code finishes the connection isn't closed. In fact it appears to
stay connected for a long period of time / indefinitely. How can I ensure
the connection is closed when leaving this procedure.

Any advise appreciated.

Tao

Jul 21 '05 #1
0 1223

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

Similar topics

1
by: robert demo via AccessMonster.com | last post by:
I'm trying to retrieve the connection string for a linked table in a backend that is password protected. I've modified the code shown below to temporarily check that the backend has been...
6
by: Steven Blair | last post by:
Hi, I am writing an application using a 3 tier model (Client, Business Layer and DB) The DB layer creates a OdbcDataReader object back up to the Client where the data is read and displayed on...
0
by: Tao | last post by:
I'm using the following code in my service to retrieve the modified date of a web page. public DateTime GetUrlSourceLastModified(string sUri) { if(!sUri.ToLower().StartsWith("http://")) sUri =...
5
by: aniket_sp | last post by:
i am using a data adapter and a dataset for filling and retrieving data into .mdb database. following is the code..... for the form load event Dim dc(0) As DataColumn Try If...
4
by: Papachumba | last post by:
Hi guys, i have a little problem and was wandering if anyone can help. I just need my query modified a little bit to allow some extra values in there... Tables: offers Table OfferID...
102
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
2
by: Patrick Pirtle | last post by:
Having programmed for a number of years with VB6 (but very little database stuff), I'm trying to learn Visual Studio, but am just about at the end of my rope as far as wrapping my mind around...
4
by: Sin Jeong-hun | last post by:
I don't get the message so it's hard to debug that, but some of my clients report that they get "The underlying connection was closed unexpectedly" exception. According to this site (http://...
1
by: Enij | last post by:
Hi All, I'm using VB.net 2003 Standard Edition, and I'm trying to retrieve the file modified date. Sounds painfully simple. Yup. But ... I cannot, for the life of me, figure it out. After...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
jinu1996
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...

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.