Questions tagged [asp.net-core-5.0]
ASP.NET Core 5 is the current version of ASP.NET Core, built on top of .NET 5. Use this tag for questions specifically about ASP.NET Core 5 and ASP.NET Core 5's formal specification. Do also include the general [asp.net-core] tag.
650
questions
0
votes
0
answers
18
views
Files not output to directory by webpack - publicPath not working
I have a simple webpack and trying to use publicPath:
const path = require('path');
module.exports = {
entry: {
jquery: './node_modules/jquery/dist/jquery.min.js',
},
output: {
...
0
votes
0
answers
33
views
How to return the media stream to the UI in a chunks and play audio
I am trying to create a prototype of the Music streaming app.
In this view, I am trying to list the track details and used audio controls to play the music.
<div class="container">
...
1
vote
1
answer
34
views
Could not load type 'System.Runtime.CompilerServices.AsyncVoidMethodBuilder' from assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral
I have a azure function app which has a dependency on another class library to accomplish certain functionalities.
Azure Function Details:
TargetFramework: net5.0
AzureFunctionsVersion : v3
...
0
votes
0
answers
19
views
On Linus, the deprecated Toupcam_Snap method of the libtoupcam.so library
Good afternoon.
The program uses the P/Invoke approach:
[DllImport(dll, ExactSpelling = true, CallingConvention = cc)]
private static extern int Toupcam_Snap(SafeCamHandle h, uint nResolutionIndex);
...
0
votes
1
answer
17
views
Asp.Net Core MVC - Image does not load/display while converting view into pdf
This is related to my last question. I am trying to convert a view into pdf. The view is getting converted into a pdf file as expected but the image inside view doesn't get loaded/displayed when the ...
0
votes
1
answer
30
views
Why IIS Server returns null baseUrl of ASP.NET CORE 5 MVC project, but returns true on local server?
I am developing ASP.NET CORE 5 MVC project and I want to use server variables to send email and show the file on new tab. In my local machine I can get the host name but after publishing on IIS, I ...
0
votes
1
answer
45
views
how to create a necessary folder according to the seed data
I am trying to create the folder with the seed data, using ASP.NET CORE 5.0.
I have the DB context setup as follows:
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext(...
0
votes
1
answer
47
views
Error get-function rgba-css-var is not a valid value for background-color
I have followed the following steps to set up Bootstrap 5 SASS in the ASPNET Core project.
right-click wwwroot and select Add->Client-Side Library. Selectected unpkg provider, bootstrap@5.1.3 ...
0
votes
0
answers
43
views
ConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s)
I wanted to achieve the AddorUpdate() using EF Core.
I was trying to add or update while seeding the datbase.
var artist = await GetArtist();
_applicationDbContext.Artists.UpdateRange(artist);
await ...
2
votes
1
answer
42
views
Localhost Error - This page can't be found - Asp.net Core MVC
I am trying to convert HTML content into a pdf file. When I click the the Print Receipt Button, it should show the pdf file of the receipt. On the contrary, it gives This page can't be found error.
...
2
votes
1
answer
74
views
How can an authenticated user access the drive that is publicly accessible?
With this code, I am able to get the files that have been shared to the service account email.
But, when I shared the folder (that was not owned by me, but is publicly accessible) from a different ...
0
votes
0
answers
25
views
HTML Encoding a JSON Request body before binding to model in dotnet5 (dotnet core)
The requirement was to ensure that we HTML encode any of the deserialized properties to prevent an API client from sending in HTML and script tags which would then be stored in the database.
For ...
0
votes
0
answers
64
views
Update Record with Composite Key - Entity Framework Core
I am having an issue updating a record with a composite key using EF Core 5 and Net Core 5. I am able to get the record using both parts of the composite key (two ids in my case) but when I save the ...
0
votes
1
answer
39
views
ASP.NET Core 5 - Decoding an AES-GCM-256 JWE
I'm trying unsuccessfully to decode an encrypted token.
I tried the AesGcm class of c# but it's giving me an error regarding the TAG:
The computed authentication tag did not match the input ...
0
votes
1
answer
61
views
create a Custom Exception Handler Middleware generating response based on client request
How to create a Custom Exception Handler Middleware. This middleware should generate a custom response based on the Calling Client. If the client is requesting via AJAX then the response should be a ...
0
votes
1
answer
38
views
Running a .NET core application using PM2
If I run my .NET core 5 webAPI console app via the exe file, it's listening to all interfaces just as I configured in my appsettings.json
If I run it via pm2, it's accessible only from 127.0.0.1 even ...
0
votes
1
answer
28
views
Configuring a self-signed certificate
I am trying to configure a self-signed certificate via appsettings.json file.
I exported my existing IIS certificate to a pfx file.
And then I have this in my appsettings.json:
"Kestrel": {
"...
0
votes
2
answers
43
views
Register IStartupFilter with TryAddSingleton equivalent in ASP.NET Core
My class library registers an IStartupFilter (using a factory) with the ASP.NET Core container:
services.AddSingleton<IStartupFilter>(serviceProvider =>
ActivatorUtilities.CreateInstance&...
0
votes
0
answers
37
views
Call a ActionFilter before handling a request to a command handler
I am trying to implement an interface IDispatcherEndpointsBuilder, from Convey.WebApi.CQRS, in a Configure method of startup of class as:
app.UseInfrastructure().UseDispatcherEndpoints(endpoints =>...
1
vote
2
answers
66
views
Signalr hosted on Azure gives 405 Method Not Allowed
Trying to deploy my website to Azure, Signalr gives the following errors on the browser:
Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
For this call:
hubs/...
1
vote
1
answer
64
views
Detect that UseStartup<TStartup> was called in ASP.NET Core
When configuring ASP.NET Core startup there's this:
.ConfigureWebHostDefaults(webHostBuilder => {
//add services here or in Startup.ConfigureServices() // (1)
webHostBuilder.UseStartup<...
1
vote
1
answer
85
views
docker could not find a file from wwwroot
It is my first attempt to run a docker image in my asp.net core 5.0 application. I have added the following configuration in the docker file.
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /...
0
votes
0
answers
84
views
.Net 5 Web Api, default System.Text.Json serialization is replaced by Newtonsoft.Json without specifying in startup.cs
How to avoid System.Text.Json to be replaced by Newtonsoft.Json, when send response from controller. When i testing my application i found json serialized by Newtonsoft.Json without specifying any ...
1
vote
1
answer
45
views
Getting IS4 to issue refresh tokens
Ok, I am failing to get IS4 to issue a refresh token during authorization_code flow, even though I (believe) turned it on, and the client is requesting it by including offline_access in the scope. I ...
0
votes
2
answers
312
views
Run async hosted service every 5 minutes in ASP.NET Core
The ASP.NET Core docs for background services show a number of implementation examples.
There's an example for starting a service on a timer, though it's synchronous. There's another example which is ...
1
vote
1
answer
65
views
Auto mapper with generic Class .NET Core 5
I have searched on Stack Overflow and googled about it but I haven't been able to find any help or suggestion on this.
I have a generic class BusinessResult<TValue> that have a value property, ...
1
vote
1
answer
84
views
How to process an iFormFile with ClosedXML with c#
I want to load an excel file into XLWorkbook
using var workbook = new XLWorkbook("iFormFile needs to go here");
var ws = workbook.Worksheet(1);
0
votes
1
answer
36
views
Custom RequiredIfAttribute not producing error message on ModelState.IsValid check
I have a custom required if attribute which I am using to validate a dropdownlist based on whether values are selected in another dropdownlist.
The code below is what the custom attribute is currently ...
0
votes
1
answer
46
views
Create a deny role attribute in .netcore 5.0
I want to create an attribute based on the authorize attribute that instead of granting a role access to an IActionResult it denies access.
I want to decorate the ActionResult with something like [...
0
votes
1
answer
73
views
How can I pass the model from Login success in Login.cshtml to _layout.cshtml in Razerpages, for dynamically add side bar menu in _Layout
I have two classes such as clsGEN_GROUP_MENU and clsSidebarMenu and I have bind clsSidebarMenu property during login time in, but I can't pass the model to _Layout.cshtml.
public class clsSidebarMenu
...
0
votes
0
answers
52
views
Asp.Net core 5 Playing with HttpContext in controller constructor blocks app.UseExceptionHandler()
Here is my congure method in Startup file :
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddLog4Net("...
0
votes
1
answer
25
views
jQuery Ajax error show Exception Response Message
I know this is a duplicate question but none of the others is helping me on this:
On the following Ajax:
$.ajax({
type: "POST",
url: "url",
data: {...
0
votes
1
answer
47
views
[Content_Types].xml unknown error in ASP.NET Core 5 (EPPlus)
I am trying to use EPPlus to manipulate my xlsm template and download to client. I believe there is no issue with excel package as I am able to save the package locally. But I need content disposition ...
0
votes
0
answers
86
views
BadRequest - error message contains property names, not properties from json attributes
I have a simple web API using ASP.NET Core 5.0.
When the user is doing a POST request I'm doing validation using https://fluentvalidation.net/ (version 10.3.6).
Problem is that for bad requests I'm ...
0
votes
1
answer
57
views
Error Ajxa call in asp.net xhr.send( options.hasContent && options.data || null )
I tried to so hard to solve it but couldn't.
I got error
xhr.send( options.hasContent && options.data || null )
while saving data this error shows in Jquery.js.
Code is working perfectly in ...
0
votes
0
answers
55
views
Generic Mediatr IRequestPostProcessor with Autofac
I want to use Mediatr's IRequestPostProcessor<TRequest, TResponse> "post-processing" behaviour processor.
The non-generic sample works for me.
But I want a generic one:
public class ...
0
votes
1
answer
77
views
NLog ignores appsettings.json within an MVC controller
According to the documentation I setup my app to use NLog for logging:
IHost host = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder()
.UseServiceProviderFactory(new ...
0
votes
0
answers
31
views
statusText and statusCode in response requests not related
am trying to cerate components for testing errors in angular and define this method in angular:
get400Error() {
this.http.get(this.baseUrl + 'buggy/bad-request').subscribe(Response => {
...
0
votes
1
answer
108
views
Verifying a JWT encrypted token with ASP.NET Core 5
After scavenging bits and pieces from the net and trying to make it work, I gave up.
So here it is:
I have an OpenID token with a signature encryption of RSA-SHA256.
I've tried the following code ...
-1
votes
2
answers
35
views
Entity Frame Core Taking too long load data using ThenInclude
I am working on application where I need to load navigation properties. I have parent child relation entities and also have sub child information which I need to load but using ThenInclude taking too ...
0
votes
1
answer
71
views
How to correctly work with SQLite InMemory database in integration test
Because Entity framework does not support _context.Database.EnsureDeleted(); when using SQLite InMemory database (https://github.com/dotnet/efcore/issues/26707). My question is, how to properly reset ...
1
vote
0
answers
145
views
When is ASP.NET Core's HttpContext.Connection.RemoteIpAddress null?
One uses HttpContext.Connection.RemoteIpAddress to get a client's IP address.
Microsoft.AspNetCore.Http.ConnectionInfo.RemoteIpAddress is marked as nullable.
It will be null when behind a reverse ...
0
votes
1
answer
82
views
ModelState IsValid returns False Using ASP.NET Core 5 MVC Identity with UserName
I'm trying to accomplish login functionality using UserName instead of Email to Login.
I'm using Bootstrap Modal dialog for loging in users with jquery and ajax for error handling.
The UserName is not ...
0
votes
0
answers
71
views
Blazor Webassembly - Controller behaviour is not working as expected
i need some help with my controller logic, especially with the repsonse of it.
It is defined as "KPIValue" and contains multiple Get-methods:
[Route("api/[controller]")]
[...
1
vote
1
answer
220
views
After migration from .NET core 2.2 to .NET 5 the application won't start after deploying to azure app service - startup timeout
I am having the following problem. A while ago I migrated my project from .net core 2.2 to .net 5. Migration itself was no problem, locally everything worked almost out of the box. But then I was ...
0
votes
0
answers
50
views
How to load a json file present in another project in .NetCore 5
I have a requirement to load a file either it might be a JSON file or an XML based on a flag and update the file and save it another location
But these files are located in another project.
So, ...
0
votes
1
answer
73
views
How to use Server.ScriptTimeout in ASP.NET Core 5 (migration from .NET framework to .NET 5)
Thanks for reading my post.
Originally, I was using ASP.NET MVC on the .NET framework, but I want to migrate to .NET 5.
However, this line of code:
filterContext.Controller.ControllerContext....
0
votes
2
answers
205
views
How do I automatically redirect when the session cookie expires?
When a user is idle for ten minutes, I would like to have an automatic redirect. Below is the test code, which is not working.
The LoginPath, LogoutPath, and AccessDeniedPath do not exist. Therefore, ...
0
votes
1
answer
106
views
IIS and .NET 5 ASP.NET MVC 5 App, HttpsRedirect not working outside IIS Server
I have an ASP.NET Core 5 MVC app, running fine on a IIS 10 server.
I've been asked to enable HTTPS and enforce it on port 6443. I have been given the certificate and configured it on IIS.
When going ...
0
votes
1
answer
62
views
Validation Attribute localization
I'm working on a ASP .Net Core 5 project, where I created a custom Validation Attribute and in case when the validation result is not valid I want to return a localized error message.
Here is the ...