Category "asp.net-core"

An error occurred while accessing the Microsoft.Extensions.Hosting services. After Adding ASP.NET identity

I have DataContext and StartUp class in different projects and to add a new migration in Data project I used the below command: dotnet ef migrations add Identit

Confirm form resubmission - ASP.NET 5 MVC

I have two controllers Booking and Checkout. Posting form data from controller Booking to Checkout index get page. I want to retrieve the object submitted when

I would like to pass the values that i have in my view to a action

I'm developing a school project using a html.beginform to when i click in a button i go to a diferent Action, but i need to pass the values that i have inside m

CORS Error in Angular App With Asp.net Core Webpi

I've been given a task to to build a web client that interacts with the following API: https://docs.openaq.org/ It should be able to send different parameters

ASP.Net MVC returning 404 for generated JS

ASP.Net MVC project is not able to serve js in wwwroot/js folder (generated by webpack). I'm getting a 404 when page is trying to access js/app.js. The csproj h

How to make other methods call after return OK response to client in ASP.Net Core

I am using the asp.net core WebAPI Project in which a client is uploading some files to a server. The whole uploading is done using chunks. The problem is when

Dynamic script content when calling spa.UseAngularCliServer(npmScript: "start");

I need to pass in dynamic content into the start script for Angular when starting it from .Net. Right now I have: spa.UseAngularCliServer(npmScript: "start"); A

ASP.NET Core - Entity Framework Core - Drop Down List - DbContext SaveChanges Issue

I'm new to using EF as well as ASP.NET Core. I'm working on a simple web application and I am getting an error when I go to save a new record. When the DbCont

Response with cached data, and how to refresh the cache form database, for a api application

Hi could someone guide me in the following problem, there must be tons of guides on this problem but for some reason I can't get google to find a nice how to, t

Ask the user before submitting the form

I have a cshtml page with this code: <form action='@Url.Action("ExportExcel", "Records")' method="post" target="_blank" onsubmit="return exportExcel(), true"

DateRange client side validation in ASP .NET6 using Fluent Validation

In my application I'm using a form to enter user information including birthdate. I want to perform both client-side and server-side validation and I'm using Fl

Can't resolve symbol "FirstOrDefaultAsync" in .Net Core Web API

I'm building a .Net Core Web API and in one of the files the FirstOrDefaultAsync() method just doesn't work although I'm using it in various files in the same p

Change request Content-Type to allow invalid/unsupported request Content-Types

A client is currently sending our ASP.NET 4.x/Core REST APIs the correct request payload but invalid request Content-Type which is resulting in 415 status codes

How to prevent HttpClient.SendAsync Method from sending duplicate data

Is there away to prevent HttpClient.SendAsync method from sending duplicate data. For context purpose am getting data from one API and posting to another API I

MiniProfiler dynamic response handling in .NET 6

Recently I have integrated MiniProfiler into a .NET 6 API and all works well, can see the SQL queries via EFCore and all on the dashboard. What I would like to

What value should I return in catch?

I just implemented a Try catch in my code, the error is because I have to return something in the catch, I can't understand is "what should I return?" 'Company

Add property to all responses in asp.net core

I have an API with multiple endpoints. I'd like to add a property to all endpoint responses, without adding it to each endpoint response model individually. Ex:

c# Microsoft Graph permissions to read mails

I have the following list of permissions on Azure AD: my ASP.NET Web Core app has the following config: { "AzureAd": { "Instance": "https://login.microso

XmlException and CryptographicException when running blazor web server app

I receive these two exceptions when I run my blazor web server app: XmlException: Root element is missing. CryptographicException: An error occurred while tryin

Xamarin - Shell.Current.GoToAsync($"//...") performance too slow on Android

I have a Xamarin project and I'm using visual studio 2019. I consume an API to access data and for my LoginPage flow I used routing in shell. So here is my AppS