Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 8th, 2005, 06:34 AM
Registered User
 
Join Date: Oct 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default UploadFile Problem

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






Similar Threads
Thread Thread Starter Forum Replies Last Post
UpLoadFile leily Pro JSP 1 May 2nd, 2006 11:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.