Backload Example #4 code not working.
public class FileUploadDerivedController : BackloadController
{
// Since version 1.9 you can call the asynchronous handler method
public async Task<ActionResult> FileHandler()
{
// Call base class method to handle the file upload asynchronously
ActionResult result = await base.HandleRequestAsync();
return result;
}
}
I get this error:
'Backload.Controllers.BackloadController' does not contain a definition for 'HandleRequestAsync'
To reproduce:
- Using VS2010, open new MVC4 project.
- To enable async in VS2010, Install VS Async CTP: http://www.microsoft.com/en-us/download/details.aspx?id=9983
- In your project, reference: [VS Async CTP Install]\Microsoft Visual Studio Async CTP\Samples\AsyncCtpLibrary.dll
Using Package Manager Command
Install-Package Backload
- Download Examples from: https://github.com/blackcity/Backload
- Open Example #4 and copy the code from FileUploadController.cs for FileUploadDerivedController class.
usings
using Backload.Controllers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Backload;
using System.Threading.Tasks;
Controller
// Change namespace to yours
namespace Backload.Examples.Example04.Controllers
{
// For all demos below open the file ~/Scripts/main.js and
// change the url of the ajax call for the fileupload plugin
// Demo 1: Derive from BackloadController and call the base class
public class FileUploadDerivedController : BackloadController
{
// Since version 1.9 you can call the asynchronous handler method
public async Task<ActionResult> FileHandler()
{
// Call base class method to handle the file upload asynchronously
ActionResult result = await base.HandleRequestAsync();
return result;
}
}
}
Error should occur on this line
ActionResult result = await base.HandleRequestAsync();