Need help with FTP and VB
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
Hey guys, it has been a while since i last posted here on this forum... :P
But now I could really use some help :S
See, im makeing this antivirus in visual basic, which has this... kinda security system i invented xD
But when they register the product, i would like the app to access my ftp server, open the "registered.txt" file, and then add the serial that they entered to registered it...
So that when an update comes, they wont have to register the app over again :S
So the main question is, how do i edit a txt file from my ftp server, from my vb app?
Any help would be appreciated ^^
But now I could really use some help :S
See, im makeing this antivirus in visual basic, which has this... kinda security system i invented xD
But when they register the product, i would like the app to access my ftp server, open the "registered.txt" file, and then add the serial that they entered to registered it...
So that when an update comes, they wont have to register the app over again :S
So the main question is, how do i edit a txt file from my ftp server, from my vb app?
Any help would be appreciated ^^
Formerly known as RyggTonning.
PM me if you have any business proposals or similar.
PM me if you have any business proposals or similar.
I was writing you an example but I couldn't be bothered. You can Upload and Download a file using a Webclient.
First, Import System.Net
Next to Download the File, We use DownloadFile, also I added a RichTextBox so you can see the file and make changes and save it.
Create a Button and then on the Button1 click add this:
With the MsgBox, if there is an error the exception is shown to us rather then the debugging stopped etc
You can Upload a file using the Webclient and use UploadFile, but you need to set the Credentials, I've always hated FTP. You can set the credentials with:
First, Import System.Net
Code: Select all
Declare WebclientImports System.Net
Code: Select all
Don't declare it in a Sub Function. Dim client As New WebClient
Next to Download the File, We use DownloadFile, also I added a RichTextBox so you can see the file and make changes and save it.
Create a Button and then on the Button1 click add this:
Code: Select all
We use the WebClient we declared, specify the address of the file, and then the location to save it. Then with the RichTextBox we don't need any dialog we use the LoadFile method but just specify that we are loading it as PlainText (otherwise it won't load as it's supposed to load Richtext not PlainText by default). Try
client.DownloadFile("http://smashapps.net/test.txt", My.Computer.FileSystem.SpecialDirectories.Desktop & "/test.txt")
RichTextBox1.LoadFile(My.Computer.FileSystem.SpecialDirectories.Desktop & "/test.txt", RichTextBoxStreamType.PlainText)
Catch ex As Exception
MsgBox(ex.Message)
End Try
With the MsgBox, if there is an error the exception is shown to us rather then the debugging stopped etc
You can Upload a file using the Webclient and use UploadFile, but you need to set the Credentials, I've always hated FTP. You can set the credentials with:
Code: Select all
If I've helped please +rep client.Credentials = New NetworkCredential("username", "password")
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
WOW i think that was the first explained in depth in Tutorial Requests
smashapps wrote:You must be very very careful with this partCode: Select allclient.Credentials = New NetworkCredential("username", "password")
i think you must use a hard encrypt for this.
or they can access your server.
and nice tut smashapps :lol:
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
I didnt actually know it was a tutorial request otherwise I would of done more lol guess I had nothing to do I decided to help out, and yes listen to Dummy encrypt your applications or someone who see everything, you never want that to happen, even your email address :P
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023