Solved

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

Posted on 2008-10-03
3
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses
Course of the Month4 days, 5 hours left to enroll

630 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