Hello people!
This is my first post here. I am currently developing an application that is supposed to get data from a website, get some product information, then place it in a database etc.
I am using webclient but the url I want to retrieve from only returns part of the page and with the message "your browser does not support frames".
How can I get the "full" page downloaded so I can parse the html(string) using my RegEx expressions? In other words get the same html as I get when I manually use the right-click and view source on the url?
I will paste some info below. Thanks in advance for all help.
WebClient fileReader = new WebClient();
fileReader.Credentials = credentialCache.DefaultCredentials;
fileReader.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
Stream data = fileReader.OpenRead(url);
StreamReader sr = new StreamReader(data);
string html = sr.ReadToEnd();
infoTextBox.AppendText(html);
Loading
Mauro BalsanoPosted May 9, 2011, 4:26 AM
Joakim AstromPosted Oct 22, 2009, 5:04 PM
Then I use the specific webpages and use the browser object to get the "stuff".
As I said, the WebClient object doesn't return all the data and gives a "your browser doesn't support frames" message. Clues?
If you use the WebBrowser object like me be sure to "catch" the returned page in DocumentComplete event or you will be confused :)
If anyone has tips for automatic login or a clue as to why I can't download it all in the WebClient or HttpWebRequest objects please let me know! Thanks. Cheers!
Joakim AstromPosted Oct 19, 2009, 5:57 AM
frame name = "header" scrolling = "no" noresize target = "main" src="/europe/corporate/jsp/navbar/c_headernavbar.jsp?printMarkup=n"
frame name="main" src="/corporate/PageFinder.jsp?pageID=&pagePath=/login/failure" marginwidth="0" marginheight="0" scrolling="auto" noresize target="_self"
This page uses frames, but your browse r doesn't support them.
I can't paste exactly how the html looks in here but maybe you get the picture? Seems to be two problems. One, being logged in, and two, my browswer client doesn't support frames!?
The whole "body" of code is sort of cut off. But when I manually use the directlink and view source (being logged in off course) I get all the generated text/code/info I am looking for.
What am I missing? Thanks in advance.
Kirtan PatelPosted Oct 19, 2009, 12:47 AM
private void btnDownloadSourceCode_Click(object sender, EventArgs e)
{
WebClient wc = new WebClient();
string Source= wc.DownloadString("http://se.ingrammicro.com/corporate/corporate.jsp");
textBox1.Text = Source;
}
Joakim AstromPosted Oct 18, 2009, 6:06 PM
http://se.ingrammicro.com/search/datasheet?skuNumber=1355556&source=search/europe/corporate/jsp/navbar/c_headernavbar.jsp?printMarkup=n
Joakim AstromPosted Oct 18, 2009, 5:31 PM
Joakim AstromPosted Oct 18, 2009, 5:28 PM
Kirtan PatelPosted Oct 18, 2009, 5:15 PM
what webpage url you are trying to download ??
tell me the page url may be i can help you :)
Joakim AstromPosted Oct 18, 2009, 5:14 PM