UploadFile

Hi everyone!

I'm having some trouble uploading a file to my webserver, using the new My.Computer.Network.UploadFile method.

This is the code i am using (The credentials are fictitiousSmile) :



Dim
filepathupload As String = "C:\uploadtest.txt"
Dim urlupload As String = "http://hamdisk.hamdev.com/jacob/uploadtest.txt"
Dim username As String = "jacob"
Dim password As String = "JCrules"
Try
My.Computer.Network.UploadFile(filepathupload, urlupload, username, password)
Catch ex As Exception
MsgBox(ex.Message)
Finally
MsgBox("Try Completed") 'To show the end of the try
End Try

 


So, that's my code.

The error I am receiving from the Catch MsgBox is "The request was aborted: The request was canceled".

I can get and FTP location to work, just not HTTP.

I hope some one will know what's up.

Thanks in advance,

Hamish.



Answer this question

UploadFile

  • RichardGodin

    Hi,

    What we meant by permission is to grant the ASP-user account write previleges to your folder.

    cheers,

    Paul June A. Domag



  • GETE

    Hi,

    I agree with Paul. You need to check the permissions. specifically, check if the 'WRITE' permissions have been added for the user on the virtual directory.

    Regards,
    Vikram

  • Msiza

    Hi,

    Sorry if I took a long time answering your post. Its ben quite a time since I have the luxury of checking the forums. Been quite busy a while.

    Well, to your inquiry. You need to add permission to the Asp.Net account because when you upload a file. Its not your local user account that's accessing the virtual folder in your server. The account responsible for this is the ASP.Net account. That's why you need to set its permission...

    cheers,

    Paul June A. Domag



  • anderskj1

    How come it need the asp user account if we supplie a username and password
  • VaibhavG

    Hi,


    Have you tried checking on your virtual directory permissions on the server




    cheers,


    Paul June A. Domag

  • SSSchultz

    is it possible to be more explicite when you say permission. I'm using IIS on windows XP and I have the same problem. I created a upload virtual directory and I put all rights to test it. Still doesn't work
  • UploadFile