This example demonstrates the DevExtreme FileManager control bound to a default file system provider. The page handler methods work on the backend.
-
Add required libraries to your project. See the following topic for more details: Configure a Visual Studio Project.
-
Add the FileManager control to your Razor Page and specify the
Remote
provider.@(Html.DevExtreme().FileManager() .FileSystemProvider(provider => provider.Remote() .Url(Url.Page("Index", "Documents")))
-
File Manager uses both
GET
andPOST
requests, so it is necessary to create handlers for both request types.public IActionResult OnGetDocuments(FileSystemCommand c, string a) => ProcessFileApiRequest(c, a); public IActionResult OnPostDocuments(FileSystemCommand c, string a) => ProcessFileApiRequest(c, a);
-
Process requests with PhysicalFileSystemProvider as demonstrated in the following demo: Physical File System.
All data operations except Download return JSON data. Return the result in the handler as follows:
return command == FileSystemCommand.Download ? (IActionResult)result : new JsonResult(result);
-
Use the IgnoreAntiforgeryTokenAttribute object to disable
AntiForgeryToken
on the Razor Page with File Manager.
(you will be redirected to DevExpress.com to submit your response)