TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
adi adi
NA
1
0
Problem accessing link by using HttpWebRequest or WebBrowser
Apr 21 2012 1:12 PM
Hello,
I have problem accessing links from a website. The site is
http://www.tv-links.eu/tv-shows/A.html
and a link that I need to access looks like this in html code :
<a
href
="
/tv-shows/Absolute-Power_25833/
"
class
="
list cfix
">
<span
class
="
c1
">
Absolute Power
</span>
<span
class
="
c2
">
2003
</span>
</a>
.
I try to access this link by forming the complete address :
http://www.tv-links.eu/tv-shows/Absolute-Power_25833/
, but when using either the
HttpWebRequest class or the WebBrowser class, the page that is opened is the main page of the site, and not the one I give as a link.
Here is the code I use for HttpWebRequest :
//request to access the link
HttpWebRequest webReq = (HttpWebRequest)HttpWebRequest.Create(new Uri(link));
//the response
HttpWebResponse webRes = (HttpWebResponse)webReq.GetResponse();
//gets the stream of data from the response
Stream streamResponse = webRes.GetResponseStream();
StreamReader sr = new StreamReader(streamResponse);
content = sr.ReadToEnd();
sr.Close();
streamResponse.Close();
And for the webBrowser:
this.webBrowserForNavigation.Navigate(link);
Can someone offer instructions on how to access the intended link ?
Thank you.
Reply
Answers (
1
)
Get results count from google with HttpWebRequest
initializing and accessing dictionary globally