Click here to Skip to main content
11,493,937 members (60,329 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hello everyone.

Yesterday I asked a question regarding how to regex out a multiline paragraph from a html source.
Today I have found a new and better approach to my probable.

This new approach involves getting an exported .CVS File. This file contains the information I need.
I have no problems navigating through the file once we figure how to download it.

You may be thinking why not use this:
Sub SubDownloadFile()
 
 Dim XLocation As String = CStr("http://www.MyClientsWebsite.com.au/agentdesktop/export/csv?type=Residential&agent=all&&order_by=CREATED_DESC") ' As you can see this is not a direct file location.

 My.Computer.Network.DownloadFile(XLocation, (CurDir.ToString.TrimEnd("\") & "\source.cvs")) ' downloads XLocation to the current directory and names the file source.cvs

 End Sub

The website requires a user to login to it.
I am using a Webbrowser control to login and navigate through the site.
This is why I think the .DownloadFile function will not work because of the session or something.
The whole idea of my project is automation in the background.

Maybe I could just navigate to it and IDK well that would defeat its job of automation everything in the background.


Any help or advice is much appreciated.


EDIT 2013-3-21 3:40PM

Hello,

I think the issue is with the sessions and cookies or something.
Is there a way to grab the session from the WebBrowser contol and use that with the Network.DownloadFile function you see above???
Posted 20-Mar-13 17:24pm
tm9333605
Edited 20-Mar-13 20:43pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello,

PLease use the code snippet similar to shown below to download the remote file.

Dim XLocation As String = CStr("http://www.MyClientsWebsite.com.au/agentdesktop/export/csv?type=Residential&agent=all&&order_by=CREATED_DESC")
// Create a new WebClient instance.
Dim WebClient myWebClient = new WebClient();
Console.WriteLine("Downloading File \"{0}\"\n", XLocation);
// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(XLocation,"foo.csv");		

Regards,
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 448
1 F-ES Sitecore 229
2 Nakul Chaudhari 225
3 OriginalGriff 225
4 CPallini 215
0 Sergey Alexandrovich Kryukov 10,237
1 OriginalGriff 8,730
2 Sascha Lefèvre 3,664
3 Maciej Los 3,392
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 21 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100