473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

http download & cookies

I have this problem.
I have to download a document from a web site in specified intervals of time
and save it to hdd.
The problem is that before I get to document I have to login to site by a
web form authentication.
The login form have an option to remember by login by storing a cookie on my
PC.
The question is may I somehow use this saved cookie in my VB app to get the
document, or is there a way to fill the login details in the login form?

TIA
Nov 21 '05 #1
3 1245
Hi,

Here is an example on how to download a file from a windows form.
You will need to add a webrequest.credentials to automatically logon to the
site.

http://msdn.microsoft.com/library/de...tialstopic.asp
Dim request As WebRequest

Dim response As WebResponse

Dim reader As Stream

Dim writer As Stream

Dim data(1023) As Byte

Dim count As Integer

Dim total As Integer

Me.Show()

Me.Text = "Downloading file ....."

Application.DoEvents()

request =
WebRequest.Create("http://www.onteorasoftware.com/downloads/multigrids.zip")

response = request.GetResponse()

reader = response.GetResponseStream()

ProgressBar1.Maximum = CInt(response.ContentLength)

ProgressBar1.Value = 0

total = 0

writer = File.Create("mylocaldata.zip")

While True

count = reader.Read(data, 0, 1024)

If count <= 0 Then

Exit While

End If

writer.Write(data, 0, count)

total += 1024

If total < ProgressBar1.Maximum Then ProgressBar1.Value = total

Application.DoEvents()

End While

reader.Close()

writer.Close()

Ken

--------------------------

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:uT**************@TK2MSFTNGP15.phx.gbl...
I have this problem.
I have to download a document from a web site in specified intervals of time
and save it to hdd.
The problem is that before I get to document I have to login to site by a
web form authentication.
The login form have an option to remember by login by storing a cookie on my
PC.
The question is may I somehow use this saved cookie in my VB app to get the
document, or is there a way to fill the login details in the login form?

TIA

Nov 21 '05 #2
I can't use webrequest.credentials because the login process is made as a
login form, can I?
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OO**************@TK2MSFTNGP10.phx.gbl...
Hi,

Here is an example on how to download a file from a windows form.
You will need to add a webrequest.credentials to automatically logon to
the
site.

http://msdn.microsoft.com/library/de...tialstopic.asp
Dim request As WebRequest

Dim response As WebResponse

Dim reader As Stream

Dim writer As Stream

Dim data(1023) As Byte

Dim count As Integer

Dim total As Integer

Me.Show()

Me.Text = "Downloading file ....."

Application.DoEvents()

request =
WebRequest.Create("http://www.onteorasoftware.com/downloads/multigrids.zip")

response = request.GetResponse()

reader = response.GetResponseStream()

ProgressBar1.Maximum = CInt(response.ContentLength)

ProgressBar1.Value = 0

total = 0

writer = File.Create("mylocaldata.zip")

While True

count = reader.Read(data, 0, 1024)

If count <= 0 Then

Exit While

End If

writer.Write(data, 0, count)

total += 1024

If total < ProgressBar1.Maximum Then ProgressBar1.Value = total

Application.DoEvents()

End While

reader.Close()

writer.Close()

Ken

--------------------------

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:uT**************@TK2MSFTNGP15.phx.gbl...
I have this problem.
I have to download a document from a web site in specified intervals of
time
and save it to hdd.
The problem is that before I get to document I have to login to site by a
web form authentication.
The login form have an option to remember by login by storing a cookie on
my
PC.
The question is may I somehow use this saved cookie in my VB app to get
the
document, or is there a way to fill the login details in the login form?

TIA

Nov 21 '05 #3
Hi,

Thats what it is for

Ken
------------------
"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
I can't use webrequest.credentials because the login process is made as a
login form, can I?
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OO**************@TK2MSFTNGP10.phx.gbl...
Hi,

Here is an example on how to download a file from a windows form.
You will need to add a webrequest.credentials to automatically logon to
the
site.

http://msdn.microsoft.com/library/de...tialstopic.asp
Dim request As WebRequest

Dim response As WebResponse

Dim reader As Stream

Dim writer As Stream

Dim data(1023) As Byte

Dim count As Integer

Dim total As Integer

Me.Show()

Me.Text = "Downloading file ....."

Application.DoEvents()

request =
WebRequest.Create("http://www.onteorasoftware.com/downloads/multigrids.zip")

response = request.GetResponse()

reader = response.GetResponseStream()

ProgressBar1.Maximum = CInt(response.ContentLength)

ProgressBar1.Value = 0

total = 0

writer = File.Create("mylocaldata.zip")

While True

count = reader.Read(data, 0, 1024)

If count <= 0 Then

Exit While

End If

writer.Write(data, 0, count)

total += 1024

If total < ProgressBar1.Maximum Then ProgressBar1.Value = total

Application.DoEvents()

End While

reader.Close()

writer.Close()

Ken

--------------------------

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:uT**************@TK2MSFTNGP15.phx.gbl...
I have this problem.
I have to download a document from a web site in specified intervals of
time
and save it to hdd.
The problem is that before I get to document I have to login to site by a
web form authentication.
The login form have an option to remember by login by storing a cookie on
my
PC.
The question is may I somehow use this saved cookie in my VB app to get
the
document, or is there a way to fill the login details in the login form?

TIA


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Daniel Ruscoe | last post by:
Hi chaps, I'm relatively new to the language, but I want to create a simple order form using PHP and cookies. Please let me know if there's a better way in this situation, database isn't...
7
by: Kai Grossjohann | last post by:
I have a JSP which does request.addCookie(cookie), then <c:redirect/> to a second JSP. Said second JSP reads the given cookies via JSP and sees that all is well: the cookies have arrived. Said...
2
by: Goober | last post by:
I have an application where we have a limited number of users and a set requirement for web access. An app that I have inherited uses cookies to set certain values (i.e. what would correspond to...
1
by: Jason Williard | last post by:
I am trying to implement several website translations. In doing so, a cookie is set so upon return to the site, they are automatically redirected. If the language is set to something other than...
16
by: Cheung, Jeffrey Jing-Yen | last post by:
I have a windows form application that generates a request, downloads an image, and waits the user to enter in login info. Unfortunately, this image is dynamic and based on session data. I have...
10
by: Henrik | last post by:
Hi,, Can anyone tell me how to log on to a internet website with username and password, navigate to other subpages on that site, and then start downloading a textfile to disk?? Thanks
17
by: Bruno | last post by:
I have a feature that is hosted on a different domain from the primary one in a frame, and need to retain values in a cookie. example: A web page at one.com contains a frame which has a page...
3
by: ramesh.nrk | last post by:
Hi, Is there any way to read the cookies which are in local machine? Can we create cookies using windows Application in the local machine? I am developing a windows application which needs...
1
by: pedalpete | last post by:
I'm building a facebook app, and have been following the guidelines and posting on the facebook message board, but can't seem to get anywhere. Facebook creates a session and cookie on the users...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.