Search code examples
c#asp.netajaxajaxcontroltoolkit.net-4.5

Ajax FileUpload Route/Querystring - DirectoryNotFoundException


I have a WebApp with an upload section.
To upload the files to a sql database I'm using a Ajax Toolkit Fileupload control.

I always get a similar error as in this post, but after hours of testing, I figured out what is causing my Problem.

My upload control is located on the SidDetails.aspx page and if open the page directly with
foo.com/Pages/SID/SidDetails.aspx
I'm able to upload files.

Page Route

but if I access the page via the route
foo.com/SID/My/1
I get a 500 internal server error

So I checked the link of the page that is causing the exception
foo.com/SID/My/1/?contextKey={DA8BEDC8-B952-4d5d-8CC2-59FE922E2923}&done=1&guid=BD327457-2013-1E97-6ADE-28612D63758E

For me, it looks like that is the problem, but I don't know how to fix this.
I already tried adding a route with query value
Route with Query
But i don't know if this is how you would approach it.


Could not find a part of the path 'C:\Windows\TEMP_AjaxFileUpload\E0E386A6-F5B5-1012-F6E5-1872E4D6EF69'.
Thats the exception that is thrown by the upload control.

I would like to keep the routes but how can I fix the problem?

I'm using Visual Studio 2012, .net 4.5 and AjaxControlToolkit 7.0930

Kind regards
CarnVanBeck


Solution

  • I run into this too, and after going crazy I fixed it.

    1. Download the ajaxtoolkit source code project and open it.

    2. Change the following row:

      this._uploadUrl = 'AjaxFileUploadHandler.axd';
      

      to:

      this._uploadUrl = '/AjaxFileUploadHandler.axd';
      
    3. Rebuild the project, get the new .dll and copy it to your /bin directory.

    This will fix the issue, giving the right path to the handler.

    PS: I came to this as:

    • I noticed some strange duplicated calls to the handler, happening only in routed paths (like www.site.com/projects/edit/mypage), where uploads failed.

    • I noticed that in a test page, placed in the home dir of my site, the uploader was working fine.

    Then I came to this page and noticed the mentioned row.