views:

89

answers:

2

I have a method that searches for movies in IMDB. Problem is, I only take into account if the site returns a page with movie OPTIONS. If the site automatically finds the movie in question, my program breaks.

Is there a way for me to check the URL of source code in C#?

+3  A: 

AllowAutoRedirect = false;

Nescio
Not exactly descriptive, but +1, because this is correct. You are redirected from the search page when there is only one result. You hit the search page and then the actual movie page. By not allowing the redirect to follow through, you'll remain on the search page - which won't have any information on it (since imdb wont even bother rendering it), but at least you'll know it happened...
Alex Sexton
+5  A: 

I think maybe you're trying to parse the page instead of using a web service to access the information. parsing a page of dynamic content is difficult, if you want them, you must create a parser capable of handling such situations you describe.

You can try these links

RRUZ
+1 for suggesting a better way to solve this.
0xA3
+1 for the responder's suggestion to handle programmatically. -0.5 to the OP for asking a question about screen scraping in an operation that's somewhat questionable in terms of intent.
jro