Skip to content

Firefox shows "attempting to reconnect to server" on performing Download operation. #50907

@sivakumars3442

Description

@sivakumars3442

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

We are attempting to execute a Download operation within the Blazor Server application by triggering a click on an anchor tag, and the download response is retrieved from the ASP.NET Core application, specifically downloading an image file located inside the wwwroot folder of the ASP.NET Core application.

Index.razor

@page "/"
@using Microsoft.AspNetCore.Mvc;
@using System.IO;
Click here to perform download using server response

HomeController.cs

namespace AspCore_Server.Controllers
{
[Route("api/[controller]")]
[EnableCors("AllowAllOrigins")]
public class HomeController : Controller
{
public IWebHostEnvironment hostingEnvironment;
public HomeController(IWebHostEnvironment hostingEnvironment)
{
this.hostingEnvironment = hostingEnvironment;
}
[Route("Download")]
public FileStreamResult Download()
{
string fullPath = this.hostingEnvironment.ContentRootPath + "\wwwroot\2.png";
FileStream fileStreamInput = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
FileStreamResult fileStreamResult = new FileStreamResult(fileStreamInput, "APPLICATION/octet-stream");
fileStreamResult.FileDownloadName = "Custom.png";
return fileStreamResult;
}
}
}

Note: I'm using the latest version of Firefox browser.

Issue screenshot
image

Expected Behavior

The download process should finish without displaying the reconnecting modal.

Note: The reconnecting issue only occurs in the Firefox browser.

Steps To Reproduce

Please find the issue replicated GitHub sample from the below link.

https://github.com/sivakumars3442/Firefox-Reconnecting-issue

Run theBlazorApp-Firefox-Download application

Make sure to start the AspCore-Server application first, as the Blazor Server application relies on it to serve download responses.

Click the link on the Blazor index page

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions