Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 1423
Product
FileUp
Version
5.4, 5.3
Title
How to Log Information about FileUp Upload Failures
Problem
How do you log information about FileUp upload failures?
Solution
When uploads fail with FileUp, you have several options for helping your application gather more information about the error. This article explores three possible error logging ideas: catching exceptions in the global.asax page, turning on FileUp's HTTP module debug, and using XFile's TransferStatusChange event to send file information from the client to the server.

Catching Exceptions in Global.asax

You can catch un-handled exceptions in global.asax by using the Application_Error event. This event will be raised when errors occur in the application, including those thrown by our HttpModule. While you can retrieve a lot of information about the HTTPModule exception by using this event, please note that it will not be possible to reveal the name of the file because the HTTPModule doesn't keep track of that information. This is because the filenames aren't known as the FileUp object parses the request in the .aspx (.uplx) page. Here is an example of what error handling in global.asax would look like:

Error Handling in Global.asax

public void Application_Error() {
    Exception ex = Server.GetLastError();
    // include only errors generated by the FileUp's HttpModule
    if(ex.Message.Contains("FileUpEeRequest")) {
         StreamWriter logfile= new StreamWriter(@"C:\temp\logs\UploadErrors.txt", true);
         logfile.WriteLine(DateTime.Now.ToString() + " Upload Failed: " + ex.Message + ex.Source + ex.TargetSite + ex.StackTrace + ex.InnerException);
         logfile.Close();
    }
}

HTTPModule's DebugLog

Turn on the HttpModule's DebugLog in the registry. It won't help you to add information in any of your own existing logs, but it will create a separate log. In production, you would want to set the debuglevel to 1 to only log errors.

For FileUp SE

  1. Open a command prompt and enter "regedit"
  2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Software Artisans\SA-FileUp\Parameters.
  3. If you don't already have keys for DebugLogFile and DebugLevel, add them.
  4. Make sure to set the path for DebugLogFile to a location that is writable by the account your application is running under. The directory must already exist, but not the filename.

For FileUp EE

If you are using FileUp EE, please go to this KB article for FileUpEE specific instructions of how to add debug registry keys.

XFile's TransferStatusChange Event

This idea applies only to applications that use XFile.

XFile fires events when an upload fails which contain detailed information about the specific files that were being uploaded. However please remember that XFile it runs on the client. This logging idea would require the developer to conceivably send a silent request to the server with the error information.
Created : 7/9/2014 10:23:38 AM (last modified : 7/9/2014 10:23:38 AM)
Rate this article!
 
Comments



Copyright 2010 © SoftArtisans, Inc. All Rights Reserved.

Site Map     |     Privacy Policy     |     Contact Us