Hello,
I am having problems using the UploadFile function in ASP.NET 2.0.
I am using the following line of
VB in my .aspx file:
My.Computer.Network.UploadFile("C:\map_6.gif", "http://www.DataHotels.net/images1/TonyPiccy.jpg", "Administrator", "xxxxxxx", True, 500)
When I run it from a browser session on the actual server where the domain "DataHotels" is hosted, and the file "map_6.gif" exists on the local C:\ drive The following error gets thrown up. "Request was cancelled" See below for dump: (If I run from the development PC, which I am producing the code from I get a Timeout error) Note that the file map_6.gif also exists on the local C:\ directry of the dev machine.
Any ideas? I have set write permissions on the director /images1 for all users.
Line 19:
Line 20:
Line 21: My.Computer.Network.UploadFile("C:\map_6.gif", "http://www.DataHotels.net/images1/TonyPiccy.jpg", "Administrator", "xxxxxxx", True, 500)
Line 22:
Line 23: Description = CType(Me.FormView2.FindControl("ImageDescTextBox") , TextBox)
Source File: C:\Inetpub\DataHotels.net\Administration\AddImage. aspx Line: 21
Stack Trace:
[WebException: The request was aborted: The request was canceled.]
System.Net.WebClient.UploadFile(Uri address, String method, String fileName) +661
System.Net.WebClient.UploadFile(Uri address, String fileName) +10
Microsoft.VisualBasic.MyServices.Internal.WebClien tCopy.UploadFile(String sourceFileName, Uri address) +82
Microsoft.VisualBasic.Devices.Network.UploadFile(S tring sourceFileName, Uri address, ICredentials networkCredentials, Boolean showUI, Int32 connectionTimeout, UICancelOption onUserCancel) +392
Microsoft.VisualBasic.Devices.Network.UploadFile(S tring sourceFileName, String address, String username, String password, Boolean showUI, Int32 connectionTimeout, UICancelOption onUserCancel) +190
Microsoft.VisualBasic.Devices.Network.UploadFile(S tring sourceFileName, String address, String username, String password, Boolean showUI, Int32 connectionTimeout) +30
ASP.AddImage_aspx.Button1_Click(Object sender, EventArgs e) in C:\Inetpub\DataHotels.net\Administration\AddImage. aspx:21
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +78
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5670
Thanks,
Tony