Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
44 views

Best practice for nested view models in ASP.NET Core 8?

I'm pretty new to web dev and have a question about how to best structure the project in currently working on. The project uses Entity Framework and ASP.NET Core 8 MVC. In my database I have the ...
Landon's user avatar
  • 538
0 votes
1 answer
42 views

Identity Model Customization .NET Core 8

I am trying to access the UserRoles property from my ApplicationUser entity and I keep getting an error message stating Invalid column name 'UserId1'. I am following this Microsoft article (https://...
Andrew's user avatar
  • 2,013
0 votes
1 answer
57 views

Pass ModelExpression for use in asp-for tag helper in Razor Pages [duplicate]

I have some repeated code I'd like to move to a Razor Pages code block, which contains an asp-for tag helper. That expects a ModelExpression, and I'm unsure how to pass that. @model IndexModel @{ ...
lonix's user avatar
  • 21.5k
0 votes
1 answer
51 views

ASP.NET Core 8: error controller method catches the error code, but does not display requested view

I'm using NLog so that when server gets error will direct action to ErrorController. Program.cs: app.UseStatusCodePagesWithReExecute("/Error/{0}"); app.UseExceptionHandler("/Error"...
user2174775's user avatar
0 votes
1 answer
121 views

Blazor interactive unauthorized .NET 8

I am building a service that uses a mix of SSR and interactive server. The SSR portion is only used to login. Now after the login completes, any request to the backend fails as unauthorized, but if I ...
silajim's user avatar
  • 33
0 votes
0 answers
45 views

The user id is getting null here

I am trying to retrieve id and I am using jwt token, but id is null. This is my code where I am getting the error: [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] [HttpPost(...
prajwal lama's user avatar
0 votes
1 answer
303 views

Prevent noisy log events with ASP.NET Core Healthchecks and Serilog

I want to use healthchecks and Serilog (with request logging), but I get a flood of useless log events, as well as ones for the failure cases. The v8 docs (and this) show there are differences between ...
lonix's user avatar
  • 21.5k
2 votes
1 answer
170 views

Registering Serilog with Logging.AddSerilog vs Services.AddSerilog

There are two ways to register Serilog. The "old" way (shown in countless SO questions and tutorials): //builder.Logging.ClearProviders(); // optional builder.Logging.AddSerilog(); And ...
lonix's user avatar
  • 21.5k
0 votes
1 answer
35 views

How to remove the User Name Field from the identity user in asp.net core 8

I want to remove the UserName field from the IdentityUser I don't want to use it
Marko Sami's user avatar
1 vote
0 answers
132 views

Docker build for ASP.NET Core 8 return error Program does not contain a static 'Main' method suitable for an entry point

I want to create a Docker image for my ASP.NET Core 8 application. The Dockerfile must be located in the root directory of the git repository, as shown in the attached image. When I place the ...
Muhammad Nasir's user avatar
1 vote
1 answer
212 views

How to configure authentication handler in ASP .NET Core?

I am developing an ASP.NET Core Minimal API, and I'm trying to use the Identity Bearer Scheme for authentication by JWT Tokens. I followed a few tutorials to try and achieve that, but I always get ...
codeouz's user avatar
  • 63
0 votes
0 answers
45 views

ASP.NET Core 8 Share identity between projects

I'm developing a multi-tenant environment where all tenants share a single database. This system has users and a user can be in one or more tenants. The system consists of 2 projects, one for the ...
John Mathison's user avatar
0 votes
1 answer
76 views

ServiceStack.Text not handling JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)

I am trying to serialize the Microsoft.AspNetCore.Mvc.ProblemDetails class and it has JsonIgnore with conditionals on its properties like Title [JsonIgnore(Condition = JsonIgnoreCondition....
odyth's user avatar
  • 4,326
1 vote
1 answer
90 views

Object as a Scoped Service, With Values being Set in Middleware, Sometimes Remains Null

I use the following to create an instance of a class for storing user information during the request: services.AddScoped<IUserSettings, UserSettings>(); Then I use middleware to set the values ...
mtl's user avatar
  • 43
3 votes
2 answers
119 views

WebApplicationBuilder.Services.AddControllers causes FileNotFoundException

Using .NET 8 - my web app serves fine on debug, but when I publish it to a folder, it throws a FileNotFound exception. Unhandled exception. System.IO.FileNotFoundException: Could not load file or ...
Joseph Coulter's user avatar

15 30 50 per page
1
2 3 4 5