UploadComplete does not seem to be working

May 18, 2011 at 6:56 PM


I can successfully upload a file to the server using metadata to define a path using the following code in the GetFilePath sub. 

But when I put code in the uploadComplete sub to copy the file to a new location, not only does the upload not work (it appears to work from the client, but no file is ever created on the server), I also never see the copy that is supposed to happen. 

Am I missing something?  This is on a Windows 2008 R2 server.

 Private Function GetFilePath() As String

        Dim _metaData As String() = Me.Metadata.Split(",".ToCharArray())
        Dim _RelativeSavePath As String = _metaData(0)

        Dim _SaveToDirectory As String = Path.Combine(fileStoreUri, _RelativeSavePath)
        SavedPathAndFileName = Path.Combine(Me.GetFolder(_SaveToDirectory), Me.FileName)

        Return SavedPathAndFileName
    End Function

    Public Overrides Sub UploadComplete()
        'Do something useful on completion.

        Dim completeFile As String = GetFilePath()

        File.Copy(completeFile, finalLocation)

    End Sub

May 18, 2011 at 9:23 PM

wrap your code in the complete sub in a try catch. you may be encountering an error. Also, you can override/implement the OnError sub to capture any unhandled exceptions.

Jun 2, 2011 at 1:59 PM

Well...with the try catch, the upload occurs, but the code within the try is obviously failing.  Another oddity with it is that if I run the project in debug, the upload fails when I have anything in the UploadComplete sub (even simply a try catch block).  If I uncomment out all code in the UploadComplete sub, then I can upload in debug.  If I publish to the IIS server, I can upload files even with the code in the UploadComplete, but the UploadComplete code is not working.  Is there anyway to step into this code when debugging?  I have put breakpoints in the code, but it never hit them.  I also never see any output messages from the Debug.WriteLine statements.




Jun 2, 2011 at 7:02 PM

This sounds more like an environment issue. With all the people that use this product, this is the first I've heard of this kind of behavior. You can download the source code and integrate into your solution versus adding a reference and then debug your app. Please let me know what you find, as I want to ensure there is not a mystery bug.

Thanks for taking the time to provide feedback...

Jun 13, 2011 at 7:00 PM

I'm finally getting back to this.  I downloaded the source, add the HSS.Interlink.Web project to my solution and added a project reference instead of a file reference to my project, yet when I put break points in the code, it never steps into the HSS Interlink project.  In fact, it never breaks on the uploadhandler.vb with in the web project of my solution.  I have the ASP.NET and the Native Code debuggers checked on the properties of the web project.  Is there something I'm missing?


Jun 13, 2011 at 7:09 PM

Can you put a break point in the BaseUploadHandler at this method void IUploadHandler.Upload(HttpContext context, FileQuery query) and see if that works? And could you provide me a copy of the solution and source files of your test project, so I can take a shot at debugging this?

Jun 13, 2011 at 11:33 PM

Also, I assume you are debuggin directly from VS (Cassini) and not IIS or IIS Express. If you are debugging in IIS (Express) then you need to ensure the AppPool identity has write permissions to the site's folder.

Jun 14, 2011 at 2:15 PM

Thank you for the help...the issue ended up being that I had a sub directory defined in the httphandlers section of the web.config.  For the path of the FileUpload.ashx, I had "UploadApp/FileUpload.ashx", this was causing the upload not to work in debug.


Jun 14, 2011 at 6:21 PM

Glad to hear you found the issue! Let me know if need anything else...

Thanks again for evaluating HSS Interlink and we have other frameworks and components you might be interested in on our website http://highspeed-solutions.net