Saturday, July 31, 2010
  Search
 
Register
Login
 
SERIES: Anatomy of a DNN Web.Config File-connectionStrings
The section holds all the necessary information for database communication from your website. At minimum, there will be at least one connection string for any DotNetNuke website...

Find this article and more in the category

Read This Article . . .

How to Use the DNNLabelEdit Control
 It's easy to use the DNNLabelEdit control, you know the one you mouse over and edit in place? Yeah, that one. In just a few minutes, you can begin using the control on your sites as well for full on...

Find this article and more in the Module Development category

Read This Article . . .

Upgrading to DotNetNuke Cambrian 5.0 from DotNeNuke 4.x
If you're looking to try out the new DNN Cambrian package, you can upgrade previous DotNetNuke installations with the following steps. Remember, as of right now, the DNN 5.0 Cambrian package availabl...

Find this article and more in the category

Read This Article . . .

Quick Check for Troubleshooting the CodeEndeavor Ajax Templates
I haven’t just installed the the template and created a module out of the box yet. However, I have come across a few things that I know to check and fix and I’m up and running in no time at all. If y...

Find this article and more in the category

Read This Article . . .

Customize Google Analytics for DotNetNuke Search
You can easily set up your Google Analytics account to track the search feature on your DotNetNuke website and take advantage of all the in depth reporting that Google has to offer. It's simple, here...

Find this article and more in the category

Read This Article . . .

Everything You Never Wanted to Know About the Config File
This is the "pre-" first installment in a series that will cover the parts of the web.config file to give you an idea of how to manipulate and customize your DotNetNuke portal. The web.config fi...

Find this article and more in the category

Read This Article . . .

New "Styles" SkinObject Found in DotNetNuke 4.9
One more addition has been added to the developer's DotNetNuke skinning toolbox with the release of DotNetNuke 4.9. Introducing...the Styles SkinObject. This little object is a very welcome addition ...

Find this article and more in the DotNetNuke category

Read This Article . . .

More Ways to Install DotNetNuke Modules with the URL Method
While DotNetNuke has a built in mechanism for installing modules, there is another method you can use as well. This is a great alternative to use especially when you are trying to install larger mod...

Find this article and more in the category

Read This Article . . .

How To Customize the Privacy and Terms Links on Your DotNetNuke Portal
Straight out of the box, DotNetNuke already has a lot of things covered. But, what do you do when you are ready to begin customizing your site. Sometimes, it’s not so easy to figure out how to make t...

Find this article and more in the DotNetNuke category

Read This Article . . .

I Need to Modify the What to Install DNN? What in the World is a Web.Config File Anyway??
 If you're wondering what in the world a web.config file is, then wonder know more. . .in about 5 minutes, you'll know more than you do now and be well on your way to moving forward.

Find this article and more in the Web.Config category

Read This Article . . .

Search for Articles

Virtual-Essential's DotNetNuke, .NET, and SQL Tips For the Developer

Minimize
Nov 19

Written by: Briana Tarrance
11/19/2008 3:03 PM 

 

With the help of the .NET framework, it is simple to download files via FTP sessions programmatically. In this example, I am going to download a stylesheet from my FTP directory and display it in the console window.

 

Figure 1: FTP Directory Showing File To Download

 

Imports System.IO
Imports System.Net

.....

Public  Sub GetFileFromFTP(ByVal ServerPath As  String)

Dim localfile As String = "C:\ftpTest.css"
ServerPath = "ftp://ftp.virtual-essentials.com/Directory/skin.css"

'Create/Instantiate Object for Communicating with the server
Dim myRequest As FtpWebRequest = FtpWebRequest.Create(ServerPath)
myRequest.Method = WebRequestMethods.Ftp.DownloadFile
myRequest.KeepAlive = False 'turn off when action completes.
myRequest.UseBinary = True 'binary, not text transfer
 

'Pass credentials
myRequest.Credentials = New NetworkCredential("username", "password")

'Create/Instantiate the response back from the server by getting the response to your request and casting as a web response
Dim myResponse As FtpWebResponse = CType(myRequest.GetResponse, FtpWebResponse)

'Get the stream from the response and assign to a Stream Reader
Dim myResponseStream As Stream = myResponse.GetResponseStream
Dim myReader As StreamReader = New StreamReader(myResponseStream)

'read the response
Dim myFile As String = myReader.ReadToEnd()
Console.WriteLine(myFile)

'Check to see if download has completed by checking the Status
Dim status As String = myResponse.StatusDescription

'close the reader
myReader.Close()

'close the response
myResponse.Close()

End Sub 

 

And here's the output:

 

Pretty Simple Right!

Copyright ©2008 Briana Tarrance

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 
 
 
Copyright 2008 by Virtual-Essentials.com Privacy Statement    Terms Of Use