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

HttpWebResponse status 404, when page has frame

Problem:
I am writting a quick and dirty web link checker for a site that allows
local business to post their web site's URL. I have encountered a probelm
when the reqested URI points to a site that contains a frame loading content
from another domain. Any insight would be welcome.

The Web Page:
I try to hit a url (see code below) say http://www.somedomain.com, works
fine from IE, but HttpWebResponse gives 404
the web site source appears in IE as :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>home.net</title>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
</head>
<frameset border=0 rows="100%,*" noresize>
<frame marginwidth=0 marginheight=0 frameborder=0 framespacing=0
name="TOPFRAME"
src="http://www.somenewdomain.com/?dn=home.net&cid=domai43992/fxallen/golfpage.htm"
noresize>
</frameset>
</html>

The Code:
private bool CheckLink( string url, WebProxy proxy )
{
bool failed = false;
HttpWebRequest request = null;
HttpWebResponse response = null;

request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Timeout = 8000;
request.Proxy = proxy;
request.AllowAutoRedirect = true;

try
{
response = (HttpWebResponse)request.GetResponse();
}
catch( WebException wex)
{
HandleWebException( wex );
failed = true;
}
catch( Exception ex )
{
HandleUnexpectedException( ex );
}
finally
{
if( response != null )
{
response.Close();
response = null;
}
}

return failed;
}

Cheers,
Howeird
Nov 29 '05 #1
0 1505

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

Similar topics

2
by: Jon Maz | last post by:
Hi All, I am using a WebRequest & WebResponse to GET the contents of an aspx page as a string (code below). It's working fine, except that when the aspx page has an error on it, I want to...
2
by: Nuno Magalhaes | last post by:
In pages that there is no content length, how does HttpWebResponse knows where the page ends? And what kind of objects/methods does it retrieve? Does it only retrieve the initial page without any...
1
by: Joe | last post by:
I'm creating an application that HTTP posts some form data, and is supposed to read the response. When I actually do this form posting from a web page, I get the response exactly as I would...
4
by: Hexman | last post by:
Code below ---- I've asked a similar question on this forum earlier. This is a slightly different situation. Previous Question ---- I'm trying to save some specific web pages to disk as...
0
by: Tom | last post by:
Hi, Could someone please help me with this I am trying to do use the following code to post a form and get response but it 's keep giving me a error "The operation has timed-out." on this line...
5
by: Prasad | last post by:
Hi all, I wanted to know whether my page is connecting to server or not using xmlHttp request. For that , I am using one condition in onreadystatechange function as.. function xxx() {...
0
by: nukiee | last post by:
I wanted to check the status code that comes back as response from the HttpWebResponse. So I used the following code - res = (HttpWebResponse) req.GetResponse(); It's working great, but if I...
4
by: JVNewbie | last post by:
I'm attempting to test an aspx module that will receive XML data from a web service (the receiver module). I want to be able to test this portion before attempting to create the Web Service that will...
2
by: pronerd | last post by:
Hi, I have a status bar that works in IE that I now need to get working in Firefox. It checks the status of a frame's .readyState attribute to see if the frame is done rendering. I am wondering...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.