Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

How to Get Data from other's web site (Screen Scraping ?)

  Asked By: Brooklyn    Date: Feb 16    Category: Asp.net    Views: 7218
  

I tryed a lot to get data from my own intranet site to get data and
show it in my site but after reading on asp101.com and
aspnet.4guysfromrolla.com i can't do it on my computer.

Could anybody help me out ?

I have WinXP/IIS5.1/.Net Framework 1.1

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Oscar Evans     Answered On: Feb 16

Does the code @
www.learnasp.com/freebook/learn/nethttp.aspx
work on your machine. If it does not what error message do you get?

 
Answer #2    Answered By: Michael Evans     Answered On: Feb 16

I got answer but it is also not working on my machine
and gives following error :

The underlying connection was closed: Unable to connect to the remote
server

And code used is (VB.NET) :


<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<script language="C#" runat="server">
void Page_Load(Object Src, EventArgs E) {
myPage.Text = readHtmlPage
("http://aspalliance.com/stevesmith/");
}

private String readHtmlPage(string url)
{
String result;
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()) )
{
result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return result;
}
</script>
<html>
<body>
<b>This content is being populated from a separate HTTP request to
<a
href="http://aspalliance.com/stevesmith/">http://aspalliance.com/steve
smith/</a>:</b><hr/>
<asp:literal id="myPage" runat="server"/>
</body>
</html>

 
Answer #3    Answered By: Woodrow Jones     Answered On: Feb 16

2 things:
1.
The code you supplied is not VB.net - it is C#

2.
http://aspalliance.com/stevesmith/
is a bum URL. It really resolves to:
http://aspalliance.com/stevesmith/articles/

try a legit URL.

 
Didn't find what you were looking for? Find more on How to Get Data from other's web site (Screen Scraping ?) Or get search suggestion and latest updates.




Tagged: