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
filepathuploadAsString ="C:\uploadtest.txt"
Dim urluploadAsString = "http://hamdisk.hamdev.com/jacob/uploadtest.txt"
Dim usernameAsString ="jacob"
Dim passwordAsString ="JCrules"
Try
My.Computer.Network.UploadFile(filepathupload, urlupload, username, password)
Catch exAs Exception
MsgBox(ex.Message)
Finally
MsgBox("Try Completed")'To show the end of the try
EndTry

So, that's my code.

The error I am receiving from theCatchMsgBox is "The request was aborted: The request was canceled".

Ican get and FTP location to work, just not HTTP.

I hope some one will know what's up.

Thanks in advance,

Hamish.

[3089 byte] By [HamdevGuru] at [2008-3-7]
# 1
Hi,
Have you tried checking on your virtual directory permissions on the server?
cheers,
Paul June A. Domag
PaulDomag at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
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

Vikram at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
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 ?
Dawidoco at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 4

Hi,

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

cheers,

Paul June A. Domag

PaulDomag at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 5
How come it need the asp user account if we supplie a username and password?
Dawidoco at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 6

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

PaulDomag at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified