473,385 Members | 1,944 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.

allowing http redirects??

I am trying to crawl the web using the following code snippet.

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Win32)";

....
By default, the req.AllowAutoRedirect is true and
MaximumAutomaticRedirections is 50.
When I try to crawl the following URL.

http://citeseer.ist.psu.edu/rd/55811...6efficient.pdf

I get NameResolutionFailure exception. However, I am able to open this URL
from the browser and it gets redirected to:

http://citeseer.ist.psu.edu/cache/pa...6efficient.pdf
How do I force my C# code to go to the redirected url?

Nov 17 '05 #1
3 1308
Jason Manfield wrote:
I am trying to crawl the web using the following code snippet.

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Win32)";

...
By default, the req.AllowAutoRedirect is true and
MaximumAutomaticRedirections is 50.
When I try to crawl the following URL.

http://citeseer.ist.psu.edu/rd/55811...oad/http://cit
eseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzc
lasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf

I get NameResolutionFailure exception. However, I am able to open
this URL from the browser and it gets redirected to:

http://citeseer.ist.psu.edu/cache/pa...zzSzwww.stanfo
rd.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf
How do I force my C# code to go to the redirected url?


What .NET version do you use? I can get this document woth no problem:

HTTP/1.1 200 OK
Date: Wed, 01 Jun 2005 20:52:37 GMT
Server: Apache/2.0.53 (Unix)
Last-Modified: Wed, 08 Nov 2000 19:17:28 GMT
ETag: "17801be-21d36-c5214200"
Accept-Ranges: bytes
Content-Length: 138550
Connection: close
Content-Type: application/pdf

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 17 '05 #2
Joerg

My .NET version is 2.0.4.

I assume it worked for you from C# code. Did you set any property in
HttpWebRequest to make it work?

My code can open the redirected URL, but not the original url (with rd in it).

Jason

"Joerg Jooss" wrote:
Jason Manfield wrote:
I am trying to crawl the web using the following code snippet.

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Win32)";

...
By default, the req.AllowAutoRedirect is true and
MaximumAutomaticRedirections is 50.
When I try to crawl the following URL.

http://citeseer.ist.psu.edu/rd/55811...oad/http://cit
eseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzc
lasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf

I get NameResolutionFailure exception. However, I am able to open
this URL from the browser and it gets redirected to:

http://citeseer.ist.psu.edu/cache/pa...zzSzwww.stanfo
rd.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf
How do I force my C# code to go to the redirected url?


What .NET version do you use? I can get this document woth no problem:

HTTP/1.1 200 OK
Date: Wed, 01 Jun 2005 20:52:37 GMT
Server: Apache/2.0.53 (Unix)
Last-Modified: Wed, 08 Nov 2000 19:17:28 GMT
ETag: "17801be-21d36-c5214200"
Accept-Ranges: bytes
Content-Length: 138550
Connection: close
Content-Type: application/pdf

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 17 '05 #3
Jason Manfield wrote:
Joerg

My .NET version is 2.0.4.

I assume it worked for you from C# code. Did you set any property in
HttpWebRequest to make it work?


Nothing special, but I tried it using .NET 1.1 SP1. It doesn't work for
me in .NET 2.0 Beta 2 either.
Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 17 '05 #4

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

Similar topics

3
by: Terry Murray | last post by:
Hi Everybody, I have been given the task of creating an online coupon system. The only real challenge that I can identify at this point is allowing only one coupon to be printed rather than...
0
by: David Levine | last post by:
This may be an easy one (I hope so). The ultimate goal I have is to be able to use binding redirects that are specific to secondary appdomains, so that each appdomain can have a unique...
8
by: Nicole | last post by:
Hi I need to be able to change the currency and some form fields displayed on my website depending on where the visitor is based. I don't need a fully functional cart, just a kinda either...
6
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx...
2
by: Mary Ann Allen | last post by:
I'm just playing around with Web Services and I've created one using the Hello World method that comes in the template, but I changed it to allow you to enter a name as a parameter. When I view the...
2
by: Rob R. Ainscough | last post by:
I'm using a single Master page. I'm having some strange results using Redirects in master pages using relative pathing i.e ~. I'm using Form authentication and whenever I navigate to my Login...
8
by: howa | last post by:
a page currently in HTTPS, I force the client to redirect to another page using HTTP under the same domain (e.g. abc.com), i.e. header("Location: http://www.abc.com/index.php"); IE...
4
by: hi2Kamal | last post by:
I have a problem. I have developed a page which inserts data into database and redirects me to some other page. but when user click the back button from top its takes him to the last page and all the...
1
by: rebuild | last post by:
Hi Experts, I wanted to know what is the difference between http://google.com and http://www.google.com it redirects to google site. What is http://<site name>.com call is? Is it kind of proxy...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.