I am trying to find a good example of the blazor File Manager control for client-side Blazor Web assembly.On the getting started page (https://blazor.syncfusion.com/documentation/file-manager/getting-started/)there is code that can be downloaded towards the end of the page.I downloaded the example code and set the default project to FileManager.Client.When running the program I get the following error (see attached screenshot):Network Error: Failed to send on XMLHTTPResponse Failed to load: /api/SampleData/FileOperationsIs the code out of date?Is there a more recent version of this example that works?Thanks
Attachment: FileManagerClientError_ab9a105e.zip
Hi Scott,
i had the same issue in blazor .NET 6 i solved it by "app.MapControllers();" for example:
app.UseStaticFiles();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.MapControllers();
app.Run();
None of the suggestion above is working in my project
I'm using a server side Blazor 20.3.0.60 and the filemanager is working properly when started locally from VisualStudio but it shows the error in attachment in the shared hosting server
I'm using .net 6.0
What am I doing wrong ?
Don't worry about this problem, I found the solution by myself
Thanks in any case
Hi Walter,
I have a similar problem with my .NET 7 project.
What is your solution?
Thank you,
Val Skordin
Val Skordin, with the shared details, you are facing an issue with implementing the Blazor FileManager component with the dotnet 7 projects. But we are quite unclear about the exact issue you are facing at your end with implementing the Blazor FileManager component. From the previous comment, we suspect that you are facing an issue with mapping the controller in the dotnet 7 application. We have prepared a local sample of Blazor FileManager with version 7 and the sample works fine from our side. Also, we have shared code details to map the controller for your reference.
Refer to the below code snippet.
|
[Program.cs],
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapBlazorHub(); app.MapFallbackToPage("/_Host"); app.UseEndpoints(endPoints => { endPoints.MapControllers(); });
app.Run(); |
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp1-1725483833.zip
Check the shared details and sample for your reference. If the issue still persists, share the exact details related to your issue. This will allow us to fully understand your issue and provide a solution that meets your needs.
Hi Sivakumar,
Thank you for your response. First of all, no problem with your components in local demo applications. But, I found some issues with API & controllers when I tried to implement File Manager to an existing project (server-side Blazor). I am working on it and collecting all the necessary data before asking for help.
Val
Hi Val,
We will wait to hear from you.
Regards,
Shereen
Same problem here, but mine is becasue of "Authorize" Attribute.
When i commmetn out it works. Any idea why ?
Hi Val,
I solved removing the <AuthorizeView> and <Authorized> tags in the razor page below
<AuthorizeView>
<Authorized>
<SfFileManager TValue="FileManagerDirectoryContent">
<FileManagerEvents TValue="FileManagerDirectoryContent" OnSend="send"></FileManagerEvents>
<FileManagerAjaxSettings Url="/api/SampleData/FileOperations"
UploadUrl="/api/SampleData/Upload"
DownloadUrl="/api/SampleData/Download"
GetImageUrl="/api/SampleData/GetImage">
</FileManagerAjaxSettings>
</SfFileManager>
</Authorized>
<NotAuthorized>
</NotAuthorized>
</AuthorizeView>
Can you please tell us how you solved it? I have the same problem...
All right it's solved for me, in my case I had to edit my controller, I changed this:
this.operation.RootFolder(this.basePath + "\\Data\\Files")
by this:
this.operation.RootFolder(this.basePath + "Data\\Files")