Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2004

Tip: Looking for answers? Try searching our database.

HttpWebRequest.GetResponse does not work on some uris

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anton Sommer - 01 Apr 2004 14:45 GMT
Hello folks,

I made an application to request webpages from the internet and it works
fine on the most of the uris but with that specific uri I need to query it
does not work. That url would be:
http://v3.espacenet.com/family?sf=n&FIRST=1&F=8&CY=ep&LG=en&PN=us4000000&IDX=US4
000000&Submit=SEARCH&Action=FilterSearch&Filter=ep%2Fen%2Fespacefilt.hts&ResultT
emplate=ep%2Fen%2Fresults.hts&ResultErrorTemplate=ep%2Fen%2Fincerror.hts&ResultC
ount=10


with this I only get back a cookie and I get back Headers in the response
object but the stream is empty, not even an errormesage site from the
server.

What could be the cause? Any suggestions welcome

           Thank you

                                   Anton
John Saunders - 01 Apr 2004 20:28 GMT
> Hello folks,
>
> I made an application to request webpages from the internet and it works
> fine on the most of the uris but with that specific uri I need to query it
> does not work. That url would be:

http://v3.espacenet.com/family?sf=n&FIRST=1&F=8&CY=ep&LG=en&PN=us4000000&IDX=US4
000000&Submit=SEARCH&Action=FilterSearch&Filter=ep%2Fen%2Fespacefilt.hts&ResultT
emplate=ep%2Fen%2Fresults.hts&ResultErrorTemplate=ep%2Fen%2Fincerror.hts&ResultC
ount=10


> with this I only get back a cookie and I get back Headers in the response
> object but the stream is empty, not even an errormesage site from the
> server.
>
> What could be the cause? Any suggestions welcome

One possible cause is that the site may actually be sending you nothing.
Signature

John Saunders
John.Saunders at SurfControl.com

Anton Sommer - 01 Apr 2004 22:33 GMT
Hello John thank you for answering,

> One possible cause is that the site may actually be sending you nothing.

well it does definitely work in IE as you can test yourself by clicking on
the posted link, what possible causes are there? The site is definitely
returning a cookie and there is header information in the webresponse but
nothing in the stream. Could it possibly expect another clientside request
after returning the cookie? Who knows anything about it?

Thank you

               Anton
John Saunders - 02 Apr 2004 00:36 GMT
> Hello John thank you for answering,
>
[quoted text clipped - 5 lines]
> nothing in the stream. Could it possibly expect another clientside request
> after returning the cookie? Who knows anything about it?

Anton,

If it works with IE but not with your HttpWebRequest, then I'd suggest using
a network monitor like ProxyTrace from http://pocketsoap.com. If I were you
I'd look at the interaction between IE and the remote site, then look at the
interaction between your program and the remote site.

Differences would be instructive...
Signature

John Saunders
John.Saunders at SurfControl.com

Anton Sommer - 02 Apr 2004 10:08 GMT
Thank you for answering John,

> I'd look at the interaction between IE and the remote site, then look at the
> interaction between your program and the remote site.

How could I do that?

Thank you

                   Anton
Jon Skeet [C# MVP] - 02 Apr 2004 10:13 GMT
> > I'd look at the interaction between IE and the remote site, then look at
> > the interaction between your program and the remote site.
>
> How could I do that?

Using the bit of his response which you snipped:

<quote>
I'd suggest using
a network monitor like ProxyTrace from http://pocketsoap.com.
</quote>

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

safezone - 27 Dec 2004 06:55 GMT
hi Anton,
this is not so complex..
just that you need to handle the cookies, and build a proper request
object and then get the response.
request = (HttpWebRequest)WebRequest.Create(UrlToSearch);
request.Method = "GET";
request.Accept = "*/*";
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)";
request.CookieContainer = cookies;
response = request.GetResponse();
stream = response.GetResponseStream();
HttpWebResponse webResponse =
    (HttpWebResponse)request.GetResponse();
WebHeaderCollection headers = webResponse.Headers;
//check for cookies after this and add them to the cookies collection

//finsh handlig cookies
return stream;

NOTE: There is an article on the web on how to access hotmail from
c#.that should be a good reference.
hope this helps
regards,
Deepak

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.