Relative Content

Tag Archive for c#asp.net-core

How to Require Authentication for Each Browser Instance with ASP.NET Core?

Our application is in ASP.NET Core (.NET 6) using a MVC architecture with an authentication model that creates an “auth” cookie. After a user logs into the application with a Browser (Chrome), opening a new instance of the browser and navigating to the application allows them access without the logon page. We would like the application to require authentication for any browser instance. The following code is from a test application that I wrote to see if the issue was our application or not (test application has same behavior):

How to Validate File Content in ASP.NET Core (C#) to Prevent Misleading Extensions?

I’m working on file upload validation in an ASP.NET Core application using C#. I need to validate the content of an uploaded file before saving it, rather than relying solely on its extension. For instance, I have files with a .abc extension that should contain text content. I want to ensure that a file claiming to be .abc actually contains valid text, as someone could potentially rename an executable file to .abc and upload it. How can I implement this validation effectively?

Partial respond in aspnet core controller

I’m creating a web api that search throw all tables of the database and it require severl minutes to finish.
Is there a way to create a method that return a partial results whitout terminating the search process?