Posts: 13
Threads: 5
Joined: Jan 2012
Reputation:
0
Alright, well now that I got my program working I need to make it so I can share it with other users.
Instead of having my Username and Password in the source, I want it to be "TextBox1.Text and TextBox2.Text.
I know this is an easy fix, I just have never had to do this so I'd appreciate it if someone helped.
My Code:
Code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.drivehq.com/My+Documents/file.exe"), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential(("Textbox1.Text"), ("Textbox2.Text"))
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim file() As Byte = System.IO.File.ReadAllBytes(TextBox3.Text)
Dim strz As System.IO.Stream = request.GetRequestStream()
strz.Write(file, 0, file.Length)
strz.Close()
strz.Dispose()
End Sub
Problem:
request.Credentials = New System.Net.NetworkCredential(("Textbox1.Text"), ("Textbox2.Text"))
Doesn't show up as an Error, but when you use the program its self it doesn't log you in.
===
I will be willing to give the full source to a few users that I think would actually try to fix it.
If you help fix this, and would like to continue helping with problems I would greatly appreciate it and I will put you in the credits.
AIM:x.Epiphany (Preferred)
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
01-04-2012, 02:11 PM
(This post was last modified: 01-04-2012, 02:14 PM by AceInfinity.)
(01-04-2012, 01:39 PM)Die Wrote: Alright, well now that I got my program working I need to make it so I can share it with other users.
Instead of having my Username and Password in the source, I want it to be "TextBox1.Text and TextBox2.Text.
I know this is an easy fix, I just have never had to do this so I'd appreciate it if someone helped.
My Code:
Code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.drivehq.com/My+Documents/file.exe"), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential(("Textbox1.Text"), ("Textbox2.Text"))
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim file() As Byte = System.IO.File.ReadAllBytes(TextBox3.Text)
Dim strz As System.IO.Stream = request.GetRequestStream()
strz.Write(file, 0, file.Length)
strz.Close()
strz.Dispose()
End Sub
Problem:
request.Credentials = New System.Net.NetworkCredential(("Textbox1.Text"), ("Textbox2.Text"))
Doesn't show up as an Error, but when you use the program its self it doesn't log you in.
===
I will be willing to give the full source to a few users that I think would actually try to fix it.
If you help fix this, and would like to continue helping with problems I would greatly appreciate it and I will put you in the credits.
AIM:x.Epiphany (Preferred)
Code: request.Credentials = New System.Net.NetworkCredential(("Textbox1.Text"), ("Textbox2.Text"))
Why are you turning variables of string values into string values themselves?
For example IF:
• Textbox1.Text = "MyValue"
Then:
• Textbox1.Text = "MyValue"
BUT
• "Textbox1.Text" = "Textbox1.Text"
You're explicitly defining that as a string value itself. And you also don't need brackets around them.
Get rid of System.Net and import it as well.
Code: request.Credentials = New NetworkCredential(Textbox1.Text, Textbox2.Text)
Don't turn into a copy and paste coder, you're not getting anywhere by doing that. And I can see that if you don't understand how types work, that you probably didn't make this. Learn the basics for yourself, and try to code things on your own. Work from beginner stages and move up.
Posts: 13
Threads: 5
Joined: Jan 2012
Reputation:
0
(01-04-2012, 02:11 PM)AceInfinity Wrote: Code: request.Credentials = New System.Net.NetworkCredential(("Textbox1.Text"), ("Textbox2.Text"))
Why are you turning variables of string values into string values themselves?
For example IF:
• Textbox1.Text = "MyValue"
Then:
• Textbox1.Text = "MyValue"
BUT
• "Textbox1.Text" = "Textbox1.Text"
You're explicitly defining that as a string value itself. And you also don't need brackets around them.
Get rid of System.Net and import it as well.
Code: request.Credentials = New NetworkCredential(Textbox1.Text, Textbox2.Text)
Don't turn into a copy and paste coder, you're not getting anywhere by doing that. And I can see that if you don't understand how types work, that you probably didn't make this. Learn the basics for yourself, and try to code things on your own. Work from beginner stages and move up. Thanks for the help, and I didn't make this whole code.
I got this code from someone, and I'm trying to edit it so I can make my program using it.
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
01-04-2012, 02:23 PM
(This post was last modified: 01-04-2012, 02:24 PM by AceInfinity.)
(01-04-2012, 02:18 PM)Die Wrote: Thanks for the help, and I didn't make this whole code.
I got this code from someone, and I'm trying to edit it so I can make my program using it.
That's exactly what I mean though, try to walk yourself through tutorials, and people that don't give you code. Write the code yourself, and you'll learn something. Nonetheless try my example code and see if it works for you.
Posts: 13
Threads: 5
Joined: Jan 2012
Reputation:
0
(01-04-2012, 02:23 PM)AceInfinity Wrote: That's exactly what I mean though, try to walk yourself through tutorials, and people that don't give you code. Write the code yourself, and you'll learn something. Nonetheless try my example code and see if it works for you.
Yeah your code did work. My program is pretty sick right now. It's an Ftp Uploader.
I'll post it when I'm done.
Thanks.
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
01-04-2012, 02:48 PM
(This post was last modified: 01-04-2012, 02:49 PM by AceInfinity.)
I wouldn't call it "your program", unless you coded the ftp bit, but you can post it if you like. Might be helpful for someone else on the forum
Posts: 13
Threads: 5
Joined: Jan 2012
Reputation:
0
(01-04-2012, 02:48 PM)AceInfinity Wrote: I wouldn't call it "your program", unless you coded the ftp bit, but you can post it if you like. Might be helpful for someone else on the forum
Here's a pic: http://gyazo.com/39dc4273c4e025f8216ae67b13b61508
Finishing it up now.
And honestly, I put a lot of work into customizing the code, plus added a lot of my coding.
It was just one bit that I got off someone else, and I ended out changing it a lot anyway.
Will be posting in a few minutes.
Posts: 5,793
Threads: 268
Joined: Sep 2010
Reputation:
85
Alright, well maybe once you post it I can hand you a few pointers and advice on how it could improve if I find anything in it.
|