Category "asp.net-core"

How do I get client IP address in ASP.NET Core?

Can you please let me know how to get client IP address in ASP.NET when using MVC 6. Request.ServerVariables["REMOTE_ADDR"] does not work.

Views not found after migrating to .NET 6

I migrated an ASP.NET CORE MVC project from .NET Core 2.1 to .NET 6. After making relevant changes, the project compiles and starts seemingly OK, but the views

Change default Identity routes in an Angular & ASP.NET Core project

I configured Angular to use "login" route to show a LoginComponent page. That's ok. But when I try to access some authorized page without login made, I got th

Error trying to create Mock.Of<ControllerContext>() for ASP.Net Core 3.1 Unit Test

As per last section of the Moq Quickstart defined here, I am trying to configure the following Mock in order to pass Form values to the controller method under

The required library libhostfxr.so could not be found. Netcore Linux

❯ dotnet ef A fatal error occurred. The required library libhostfxr.so could not be found. If this is a self-contained application, that library shou

Authorization in ASP.NET Core. Always 401 Unauthorized for [Authorize] attribute

For the first time I'm creating Authorization in ASP.NET Core. I used tutorial from here TUTORIAL The problem is when I sending request from postman: Authori

How to use alert(),confirm() and prompt() function using Blazor?

I am learning the Blazor technology. I started a default increment project in VS 2019 and I have modified the code for Decrement with confirm() and alert but it

How to pass model value IFormFile from view to controller On Change event

$(".uploadFile").on('change', function () { console.log('new file uploaded') //var array = $("#productImage").getIdArray(); var file

ASP.NET Core: Error while Updating Migration (Database first approach)

I have created an application in .NET Core where I am trying with database first approach. I was able to add Migration using "Add-Migration InitialCreate" but

Azure.Messaging.ServiceBus Error when completing or abandoning message

Som I'm currently looking into updating our very simple service bus service to the latest version (Asure.Messaging.Servicebus) and I'm running into a smaller pr

The default XML namespace of the project must be the MSBuild XML namespace

I cloned the ASP.NET Core SignalR Repo locally, and try opening the solution from within the following environment. IDE Microsoft Visual Studio Enterprise 201

How to access ASP.NET Core web server from another device

I created a project using C# and ASP.NET Core empty and it worked on localhost - how can I access it from another device using the IP of the computer running th

Confuse about Nuget and Libman in VS2022

I am new to .NET Core web development. In VS2017, when I install jQuery using Nuget, a message will be shown suggesting to use Libman instead. However, in VS202

IList returning count=0 on posting back updated checkboxes

I'm using asp.net-core with razor pages. I'm trying to update the checkboxes in the table. When clicking on button save I pass with asp-route-for because I wan

ASP.NET Core fails to load assemblies after migration from .NET 5 to 6.0.1

Recently, I upgraded our ASP.NET Core Web API project from .NET 5 to .NET 6.0.1. It was initially developed in .NET 5, but since this version is EOL somewhere t

Uncaught SyntaxError: Invalid regular expression [intlTelInput]

I am trying to use intl-tel-input in Asp.net core 6.0 razor pages Here is my Scripts $(document).ready(function(){ $('#tbxPhone').intlTelInput();

How to check radiobutton with Enum value in Asp.net core mvc view?

I have rendered my view like below <div class="row row-margin-zero"> <label class="radio-inline margin-rightt-ten margin-leftt-five margin-top-none

.Net Core 3.1 - Set ForContext for Serilog with Microsoft Ilogger interface

How to dynamically set ForContext property for Serilog logger using Ilogger interface from Microsoft.Extensions.Logging? Here's the code: private readonly ILogg

.NET core - Configure JWT Authentication at runtime

I have an ASP.NET Core 2 Web Application and I am using the [Authorize] attribute on the controllers that require authentication. As authentication mechanism, I

The constraint reference 'string' could not be resolved to a type. (netcoreapp3.0)

I have got an error. This is my Startup class. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); } public void Confi