Solved

VB.NET - How do I download a webpage that requires cookies, etc?

Posted on 2008-10-03
3
383 Views
Last Modified: 2008-10-27
I've got a program that directly queries URLs, but i get junk results from web pages that require cookies, among other things.

Is there some way to simulate cookies programmatically, or is there some way to use a browser daemon or something to do the querying?

Thanks
0
Comment
Question by:hamlin11
3 Comments
 
LVL 2

Expert Comment

by:madivad2
ID: 22641853
Generally: I'm interested to know the answer to this one as well... I'd assign additional points to the correct answer, if I could :-)

To the OP: what type of information is in the cookies that the absence of results in junk? I have recently got around an autologin cookie by having my page complete the login process... That answer is here: http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23785739.html

Obviously, if your cookie is more than logging in, then you need another answer... good luck
0
 
LVL 11

Accepted Solution

by:
AkisC earned 500 total points
ID: 22648948
Dim strPost as string=""
strPost=<<you probably have to login or something here. So you create your post string>>


Dim postURL as string=""
postURL="http://www......."

            Dim objHTTP As MSXML2.ServerXMLHTTP
            objHTTP = New MSXML2.ServerXMLHTTP
            objHTTP.open("POST", postURL, False)
            objHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8")
            objHTTP.send(strPost)
'//objHTTP.send   'if you do not have to post anything
            If objHTTP.readyState = 4 Then
                If objHTTP.status = 200 Then
                    vReportvFileToChk = objHTTP.responseText
                    Dim aCookie As String = objHTTP.getResponseHeader("Set-Cookie")
                    MyCookie = aCookie
                End If
            End If
0
 

Author Comment

by:hamlin11
ID: 22760228
I'll let you both know how this works asap
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question