
December 28th, 2012, 11:56 PM
|
|
Registered User
|
|
Join Date: Aug 2010
Posts: 1
Time spent in forums: 25 m 30 sec
Reputation Power: 0
|
|
|
Visual Basic 2012 FTP Application Error Help
I am currently Developing an anti-Cheat program for Counter-Strike 1.6 and I am having a problem with the Button3_click whenever i click that button to upload the "file" to the server it crashes and gives me this error.
Quote: | An unhandled exception of type 'System.UriFormatException' occurred in System.dll Additional information: Invalid URI: The format of the URI could not be determined. |
Code:
Public Class Form1
Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
Application.Exit()
End Sub
Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click
Me.WindowState = FormWindowState.Minimized
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
PictureBox1.Image = screenshot
Dim savefiledialog1 As New SaveFileDialog
Try
savefiledialog1.Title = "Save File"
savefiledialog1.FileName = "*.bmp"
savefiledialog1.Filter = "Bitmap |*.bmp"
If savefiledialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
PictureBox1.Image.Save(savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
End If
Catch ex As Exception
End Try
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("server28.000webhost.com/public_html/config.cfg"), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential("a7977306", "PASSWORD")
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim file() As Byte = System.IO.File.ReadAllBytes("C:\Program Files\Steam\steamapps\payne38\counter-strike\cstrike\config.cfg")
Dim strz As System.IO.Stream = request.GetRequestStream()
strz.Write(file, 0, file.Length)
strz.Close()
strz.Dispose()
End Sub
End Class
|