Upload Page Reload

Hello.
I'm using the Upload component in a project and I'm mostly simply coping the code from the examples.

this is my controller code:

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;

namespace CRM.Controller
{
    [DisableRequestSizeLimit]
    public partial class UploadController : ControllerBase
    {
        private readonly IWebHostEnvironment _webHostEnvironment;
        private string uploadDirectory { get; set; } = "uploads";
        public UploadController(IWebHostEnvironment webHostEnvironment)
        {
            _webHostEnvironment = webHostEnvironment;
        }

        [HttpPost("upload/single")]
        public async Task<IActionResult> SingleUpload(IFormFile file)
        {

            try
            {
                await UploadFile(file, "template");
                return Ok(file.FileName);
            }
            catch (Exception ex)
            {
                return StatusCode(500, ex.Message);
                throw;
            }
        }

        [HttpPost("upload/multiple")]
        public async Task<IActionResult> MultipleUpload(IFormFile[] files)
        {
            try
            {
                foreach(var item in files)
                {
                       await  UploadFile(item, "template");
                }
                return StatusCode(200);
            }
            catch (Exception ex)
            {
                return StatusCode(500, ex.Message);
                throw;
            }
        }
        public async Task UploadFile(IFormFile file, string folder)
        {
            if ((file != null) && (file.Length > 0))
            {
                var uploadPath = Path.Combine(_webHostEnvironment.WebRootPath, uploadDirectory, folder) ;
                if (!Directory.Exists(uploadPath))
                {
                    Directory.CreateDirectory(uploadPath);
                }
                var fullPath = Path.Combine(uploadPath, file.FileName);
                await using (FileStream fs = new FileStream(fullPath, FileMode.Create, FileAccess.Write))
                {
                    await file.CopyToAsync(fs); 
                }
            }
        }

    }
}

in my razor component page I have the following snippet of code:

                <div class="row m-0">
                    <RadzenText TextStyle="TextStyle.Subtitle1" TagName="TagName.H3">
                        Nome Template
                    </RadzenText>
                </div>
                <div class="row p-2">
                    <div class="col-md-10">
                        <RadzenTextBox @ref="templateName" Change=@(args => OnChange(args, "TemplateName")) Placeholder="Nome Template..." class="w-100" />
                    </div>

                    <div class="col-md-2">

                        <RadzenUpload Url="upload/single" Accept="text/html" Progress="@((args) => OnProgress(args, "Single file upload"))" Complete=@CompleteUpload
                                  ChooseText="Selezione Template..." class="float-end"></RadzenUpload>
                        
                    </div>
                </div>

The upload functionality works as a charm, the only problem is that when I upload a file the page is reloaded and all the data in the other data gets reset (dropdowns as default, textboxes empty and so on).

Note: I'm uploading an HTML files, maybe this is the issue?

Any help on what I'm doing wrong?

Just tried uploading our getting started page saved as HTML and it worked normally without any refresh:

I don't understand why, but with the html files I used it's not working (loads file but re-renders the page loosing all the other form data) and it works with all other file types. I'm working it around loading a zip file with all the html references inside (images, javascript, ...).

Maybe there is something in the project settings but after the await file.CopyToAsync(fs); it resets the page.

Thanks for the try.

I suspect that your application is restarting. We have seen similar behavior before - the ASP.NET process monitors for changes certain locations within the application and restarts.

I think you're correct:
In my case if I simply upload my template zip file with the html inside to the server everything is ok and I can go on working on the razor page.
As soon as I do something else ie: decompile the zip file into a new subdirectory, if it contains an html file the page reloads, otherwise I can keep working.

I tried unzipping a file with the html file as mime type html (index.html) and page reloads, while unzipping the same file with mime type txt (index.txt) page doesn't reload.
index.html and index.txt are the same file with different extension.

My guess it's a security issue.