All Questions
Tagged with asp.net-core .net
6,406
questions
0
votes
1
answer
21
views
Using Serilog to log at various levels of verbosity across namespaces and classes
I was led to believe that I can set a global minimum level of Information and then in particular namespaces or classes I could bump it up to Debug or even Verbose. This is the code:
using Commons;
...
0
votes
1
answer
72
views
How to loop through Inner list of object
I have a need where I need to loop through sublist of each class.
public Class A
{
public int IdA {get;set;}
public string Name {get;set;}
public List<Class B> Items {get;set;}
}
public Class ...
0
votes
1
answer
30
views
How can I write a HotChocolate middleware that acts after UseFiltering?
I am building a GraphQL interface in an existing dotnet webapi using HotChocolate v13.
I want to write a middleware in a field that has UseFiltering(), which as far as I know is a middleware as well.
...
0
votes
1
answer
69
views
Is there a way to make a Blazor website fully work offline?
We have a Blazor website made, but the client needs it to work offline.
I need to load all the data necessary when there is internet connection so that i can later use it in the pages. Not just ...
2
votes
2
answers
58
views
How to Refresh IConfiguration
I am using .Net 8 DI to load IConfiguration on startup.
It will be loading key-values from azure keyvault.
But, after few hours the key-values would change.
So how to refresh IConfiguration ...
0
votes
0
answers
42
views
.net running on kestrel cannot start BackgroundService in staging/production environment
I have created a QueuedHostedService extending BackgroundService following official docs here. This runs just fine on development mode and I am able to step into/debug the task passed to the ...
0
votes
0
answers
34
views
.NET 8 Angular and ASP.Net Core proxy config
I am working with the ASP.Net Core and Angular first time, so maybe the problem is easy to solve but I have not found a solution yet.
When the solution is create with the default visual studio ...
0
votes
0
answers
14
views
Using AzureB2C Invite flow prevents EnableTokenAcquisitionToCallDownstreamApi from working. Can I use two custom policies?
I'm trying to work with AzureB2C's invite flow from their samples
(https://github.com/azure-ad-b2c/samples/tree/master/policies/invite)
I have setup the two custom policies
B2C_1A_InvitePolicy
...
1
vote
4
answers
104
views
How to ensure a specific method is called after method chaining in C#?
I'm trying to create an API in C# that uses method chaining. I want to ensure that at the end of the chain, a specific method (e.g., Throw()) is called. If this method is not called, an exception ...
0
votes
2
answers
43
views
Set selected values in multi-select drop-down list in .net core 8
In my .Net 8 form, I have a multi-select drop-down list. The selected values are stored in the DB as a string delimited by commas e.g. A,B,C. How should I bind selected values to my drop-down list?
...
0
votes
0
answers
32
views
.net mvc project sdk package error: MSB4019: The imported project "../Microsoft.NET.Sdk.Common.targets " was not found
My project was working smoothly until a while ago I reopen it to find the following error when trying to build it (I'm using vs code)
I noticed sdk 8.0.107 being recently updated/implemented ...
1
vote
2
answers
40
views
Adding extra properties to ILogger<T> structured logging
Using ILogger<T>, is there a way to add log properties in addition to the ones covered by the message template?
For example:
_logger.LogInformation("Order {OrderNumber} was registered."...
0
votes
0
answers
52
views
Char code is different between .NET 4.8 and .NET 6
Previously with VB.NET (.NET 4.8) I have read files with the encoding windows-1252 in that way:
File.ReadAllText(filePath, Encoding.GetEncoding(1252))
Now in my ASP.NET Core 6 application I'm reading ...
0
votes
1
answer
32
views
RabbitMQ Client .Net Core Timing Out under load after rabbitmq upgrade. Consumer System.TimeoutException
We have a system that was running RabbitMQ 3.8.5 with RabbitMQ.Client 5.2.0. Part of the way the system uses rabbit is by creating a consumer to wait for a specific command from a different executable ...
0
votes
0
answers
26
views
Need to order by list using row value using entity framework [duplicate]
I have data in following format as shown in the sample table data. I want to order by this data in ascending order for ND values.
Means like from ND1 to ND10.
I tried the following way:
return await ...
0
votes
1
answer
30
views
.NET -> how to make API with nested Objects?
Is there any tutorial in .NET how to make the following API structure in which will [HttpPost] DestinationPlan to the database (with nested object of DestinationPlanDays - Destinations - ...
1
vote
1
answer
31
views
Why HttpClient.GetAsync returns 302 while trying to download zip file from external server? (FIXED)
in my project i have file dowloader spot. Any file i can dowload except zip. When i try to dowload zip file from other server it returns to me redirect. Do you have any idea what can be cause of that?
...
-1
votes
1
answer
72
views
Synchronize large csv file into DB with dotnet core
I want to develop a batch process in .NET Core to synchronize a CSV file containing 3 million lines. The process reads data from the file, updates existing items in the database, and creates new items ...
-1
votes
0
answers
23
views
How do I Copy Metronic(8.2.6) Files into my Asp.net Core project?
I'm a beginner at metronic,and now i have metronic8(8.2.6) Files.
I create asp.net core admin Project,and want use Metronic for UI.but i don't know how to copy Metronic's JS/CSS etc files into my ...
0
votes
0
answers
85
views
How can I improve performance and increase the speed of processing data so that it takes short time read and process 500,000 records
I'm having a .net core console application that reads parts of the JSON files stored in a folder the part of the JSON that I'm reading contains greater than 500,000 records in it, I'm able to read all ...
0
votes
1
answer
35
views
How to validate token without kid
Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: 'IDX10503: Signature validation failed. Token does not have a kid. Keys tried: '[PII of type 'System.Text.StringBuilder' is ...
0
votes
1
answer
33
views
Error during XSLT transformation: An error occurred while loading document 'https://ex.com/example.xml'. See InnerException forcomplete description
I keep getting an error during XSLT transformation: An error occurred while loading document 'https://www.example.com/myxml/example.xml'. See InnerException for a complete description of the error. I ...
0
votes
1
answer
47
views
Token Request Failing and Returning error invalid grant
These are the IdentityServer logs:
2024-07-04 21:06:57.551 -04:00 [DBG] Start key discovery request
2024-07-04 21:06:57.552 -04:00 [INF] Request finished HTTP/1.1 GET https://localhost:44322/.well-...
-3
votes
1
answer
36
views
why don't Show EF Core 6, AppDbContext onModelCreating in modelbuilder.HasDefaultSchema("Schema name"); [closed]
why dont Show EF Core 6, AppDbContext onModelCreating in
modelbuilder.HasDefaultSchema("Schema name");
i tried different methods,
I almost asked the AIs too,
ChatGPT, Bing etc. but somehow ...
0
votes
1
answer
29
views
Locale "ar-KW" is not getting listed CultureInfo.GetCultures(CultureTypes.AllCultures) in Windows10 .NET 8 Blazor WASM
I'm trying to list all the cultures available in a dropdown so that end user can choose a language-REGION locale code.
I have <BlazorWebAssemblyLoadAllGlobalizationData>true</...
0
votes
0
answers
23
views
Why Microsoft don't publish the list of tags on DockerHub repository
Does anyone knows why Microsoft don't use the "normal" repository style on DockerHub ? Why we can't browse the versions and tags ?
All the other official images (and unofficial) can be ...
0
votes
3
answers
43
views
Change cache-control max-age-48000 to cache-control max-age=48000 in response header
I need to change the hyphen to equal to for my cache-control max-age
I am not getting where it is coming from kindly help me with it.
I checked iis config as well but nothing found there.
Thanks in ...
0
votes
0
answers
45
views
How to preserve large database query results on the server for future processing
I have an ASP.NET Core Razor pages application that displays data in a Javascript chart. In some scenarios, this chart can have up to 1 300 000 datapoints / database rows. Depending on the selected ...
0
votes
0
answers
33
views
Bypass Fiddler configuration not working for non-browser
I need exclude an URL from the Fiddler settings, which should be routed internally and not via proxy. Fiddler is configured to act as system proxy and is monitoring all connections.
For this I'm using ...
-1
votes
1
answer
40
views
In .net core I want to get API through the two tables
In .Net core I have two tables with Buyer,
and the relation table as RicePrice:
public class Buyer
{
[Key]
public int Id { get; set; }
public int Quantity { get; set; ...
-1
votes
1
answer
53
views
How does a Task understand that it has already been executed if the thread is released?
For example, if I asynchronously contact the database with a request. How should a Task understand that it has already been completed and change its status?
Do I understand correctly that when I ...
0
votes
1
answer
45
views
How can I render a Razor Page (PageModel) to HTML?
As weird as may sound, is it possible to render a Razor Page (a PageModel derived class) to Html?
To give you an idea of why I'd need this, I'm looking for ways to try nest Razor Pages.
For example, ...
0
votes
2
answers
99
views
ASP Versioning, UrlSegmentApiVersionReader, routes match nonsense version numbers
I am using the ASP Versioning library to version an MVC controller Rest API in a microservice.
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft....
0
votes
0
answers
33
views
GetDisplayUrl not getting correct http scheme
Background:
I am trying to get my endpoint URL from HttpContext for attribute validation work where the URL needed to be fully identical. The problem happens when I try the get the full URL, where the ...
0
votes
1
answer
44
views
Achieving userManager user without tracking it
public async Task<CreateSuperUserResponse> UpdateAdmin(AppUsers appuser)
{
// var userLog = await application.Users.AsNoTracking().FirstOrDefaultAsync(x => x.Id == appuser....
-1
votes
1
answer
97
views
Unhandled exception. Microsoft.Data.SqlClient.SqlException (0x80131904) [duplicate]
I cannot connect to the database and do migration even though my connection string works fine when I connect SQL Server Management Studio through Docker file, I wonder what am I doing wrong.
my ...
0
votes
0
answers
12
views
Where can I use FromService attribute in Asp.net core? [duplicate]
Hi I want to know where and when I can use fromService attribute for inject services in asp.net core?
0
votes
1
answer
92
views
Proper use of HttpClientFactory for large amount of concurrent requests
I have a .NET Core 8 project where i need to send large amount of concurrent request as fast as possible to a SOAP webservice. I am experiencing long responsetime when creating new HttpClient per ...
0
votes
0
answers
49
views
What should the Startup.cs and Program.cs files contain in .NET 4.6.1
I have manually changed the target framework of my Web API from .NET 8 to .NET 4.6.1 for compatibility reasons. My question now is how I should change my Program.cs file and other config files for the ...
-3
votes
1
answer
92
views
Creating a .NET app which contains two separate WebApplications
I have an app that needs to have two separate web applications, listening on different ports, for different uses.
I feel like the way I'm currently doing it is messy, or possibly dangerous.
My current ...
0
votes
0
answers
65
views
Keycloak doesn't return token
I'm facing a strang issue with keycloak.
My application is in .Net 8. I managed, 2 years ago, to make it work with keycloak on docker in my dev environment and now I'm trying to make it works with ...
0
votes
1
answer
78
views
Asp.net core 8 select multiple with default selected not working after upgrade
This code for select multiple with default selected options was working fine on .netcore 5 but after upgrade to .net 8 selected options not working
c# code
List<int> currentContentCatIDs = ...
0
votes
1
answer
29
views
Can an AppUser : IdentityUser get linked to an Employee-entity while keeping separation of concerns with Dependency inversion in Clean architecture
I have chosen to define ApplicationUser class like this in the infrastructure-layer:
namespace MySolution.Infrastructure.Context
{
// Add profile data for application users by adding properties to ...
0
votes
1
answer
59
views
Blazor docker app, not getting the ssl certificates
I'm creating a webpage on blazor visual studio using kestrel hosting service. I'm executing it on an alpine server. Here's the code of program.cs:
var builder = WebApplication.CreateBuilder(args);
...
...
-1
votes
0
answers
39
views
How to connect to on-premises SharePoint using ADFS authentication in a .NET 8 application
Since OfficeDevPnP.Core is not supported in .NET 8, are there alternative libraries or approaches to connect to on-premises SharePoint using ADFS authentication in a .NET 8 application?
Current ...
1
vote
1
answer
85
views
How do I ensure middleware runs before AuthorizeAttribute in ASP.NET Core (Blazor)?
I have a Blazor page that makes use of the [Authorize] attribute to trigger challenge with Discord OAuth2 flow.
@page "/mypage"
@using Microsoft.AspNetCore.Authorization
@attribute [...
0
votes
1
answer
64
views
DateTime format not showing correctly on iPhone in ASP.NET web application
I have a razor pages web application that shows DateTimes throughout the application. Everything works great on a desktop browser at all media sizes (including mobile). But when I view the application ...
0
votes
1
answer
47
views
.net 8 blazor navlink style not working for external url
When using an external URL for the href attribute, the style of the menu list item changes. I want the style to remain the same. How would I do that.
Menu
<div class="nav-item px-3"&...
0
votes
0
answers
37
views
.NET Core 8 cookie value getting formatted
I have an api which I migrated from .NetFramework to .net core 8.
The API returns a string a,b. While the string value is properly stored in .Net Framework. In .net core 8, it is getting replaced with ...
0
votes
1
answer
31
views
How do I automate dbset operations in my application?
I have a project with a large number of entities and a project that can expand further in the future. At this point, I want to automate my dbset operations. In this case, what kind of generator should ...