473,394 Members | 1,841 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,394 software developers and data experts.

Accessing the javascript on a webpage using Webrequest/Webresponse

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(),
Encoding.Default).ReadToEnd();
webResponse.Close();
......

This returns me a string of HTML as expected.

If I go to the website in an IE browser and View Source I see some
Javascript.

I want the webResponse string to return the javascript that I can see
in the browser script.

Can anyone help.

Thanks
Gavin
Nov 16 '05 #1
2 9667
Hi,

Your code snippet gives you exactly what the remote web server produced as
the web page contents. If you see script in the IE source, the script is
most likely also in the returned HTML string. The only exception I can think
of is when the initial portion of the script adds further script to the page
through DHTML object model.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

<gi***@consultant.com> wrote in message
news:de**************************@posting.google.c om...
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(),
Encoding.Default).ReadToEnd();
webResponse.Close();
.....

This returns me a string of HTML as expected.

If I go to the website in an IE browser and View Source I see some
Javascript.

I want the webResponse string to return the javascript that I can see
in the browser script.

Can anyone help.

Thanks
Gavin


Nov 16 '05 #2
gi***@consultant.com wrote:
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(),
Encoding.Default).ReadToEnd();
webResponse.Close();
.....

This returns me a string of HTML as expected.

If I go to the website in an IE browser and View Source I see some
Javascript.

I want the webResponse string to return the javascript that I can see
in the browser script.


I guess the page checks the user agent. Try pretending to be some
browser, like

webRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE;
rv:1.7.5) Gecko/20041108 Firefox/1.0";

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 16 '05 #3

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

Similar topics

1
by: John | last post by:
I am in need to find a way to get the HTML from an internal URL. For example: I have page : default.aspx?page=Test, I need to get HTML of that page after rendering. At first thought, I would...
9
by: Justin Engelman | last post by:
Hi, I have a website that uses an ISAPI filter that will redirect anyone going to any page on the site to an SSL login page (on a different website with the same root domain) if they do not have...
0
by: Gordon | last post by:
I use the following code to get source HTML. The second line seems to work when I get no response from a site. However, I want to stop the request if it's taking more than 20 - 30 seconds. I can't...
3
by: Loane Sharp | last post by:
Hi there I use the FileStream object to download a zip file over the internet to my local disk. The file downloads successfully, but when I attempt to unzip it, I'm told that the file is in use...
4
by: Savas Ates | last post by:
I have a vb.net web application. I want to post some variables to another web page and take some values back and process them. This is codes in my target url. I should post "langpair" cariable...
2
by: kkb | last post by:
Hello! First, I'm sorry because of my english... I'll try to be understandable! I've got a strange problem using .NET 2003 C# and I haven't figured it out for a long time. I'm implementing an...
3
by: Gina_Marano | last post by:
Hey All, I need to download 1 or more files from a secure or unsecure website folder using HTTP. Here is what I have so far: public void GetHTTPImages() { WebClient HTTPClient = new...
0
by: Rama Jayapal | last post by:
i have used the following code string html = "http://monsterindia.com/"; System.Net.HttpWebRequest webrequest = (HttpWebRequest)System.Net.WebRequest.Create(html); ...
0
by: Jeff | last post by:
hey asp.net 3.5 I'm developing a webportal which need to access a webpage of a external system. The external webpage contain a table which I want to retrieve the values from.. it is a html...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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...

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.