Solved

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

Posted on 2008-10-03
3
378 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
Comment Utility
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
Comment Utility
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
Comment Utility
I'll let you both know how this works asap
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now