Skip to content

Example 04

Steffen Habermehl edited this page Mar 23, 2017 · 14 revisions

Using your custom handler

Sometimes you want to setup your own controller instead using the built in controller to receive incoming requests, before calling Backload. to handle file operation. Common scenarios are: Process additional form fields, logging, access control, executing additional business logic, store meta data in a database, etc. This can be easily achieved by creating an IFileHandler instance and call low or high level API methods.

// custom file handler endpoint url: "/CustomHandler/FileHandler"
public class CustomHandlerController : Controller
    [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post | HttpVerbs.Put | HttpVerbs.Delete | HttpVerbs.Options)]
    public async Task FileHandler()
            // Create and initialize the handler
            IFileHandler handler = Backload.FileHandler.Create();

            // Call an execution method and get the result
            IBackloadResult result = await handler.Execute(false);

            // MVC: Helper to create an ActionResult object from the IBackloadResult instance
            return ResultCreator.Create(result);
            return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);



This example shows how to call the file handler from your own code. In JavaScript you can call this custom handler by the endpoint url "/CustomHandler/FileHandler". In another example we bind Event handlers to events.


You can’t perform that action at this time.