Solved

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

Posted on 2008-10-03
3
380 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 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