37,950 questions
0
votes
1
answer
557
views
ASP.NET webforms on .NET 4.8 with Web API : authentication issue - 401 Unauthorized error
I work on a old legacy ASP.NET web forms application on .NET 4.8, which includes a Web API. The web form application uses Windows authentication, but the API must be accessible by any kind of client. ...
0
votes
0
answers
132
views
async method has side effects that break JsonConvert.Serialization: Self referencing loop detected -- Path 'moveNextAction'
Weird async issue. I have a reasonably complicated set of mapping logic in a service for a WebAPI project. If I run the code as-is, I get an error like the following:
Newtonsoft.Json....
0
votes
1
answer
46
views
StatusCode: 415, ReasonPhrase: 'Unsupported Media Type', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent
I've this situation:
server side:
[ApiController]
[Route("[controller]")]
public class TestController : Controller
{
[HttpPost]
public IActionResult Action(byte[] value)
{
...
0
votes
1
answer
299
views
I am getting 400 Bad Request error on Post Request
I have built an MVC application which includes CRUD methods for a user to update some data. The controller for the update UI makes an HTTP call to another MVC controller, which is in my microservices ...
0
votes
1
answer
61
views
How can I fix a many to many relationship between two entities so that the third table is filled automatically in entity framework and web API (C#)
So I have a Customer entity and a Movie entity and I configured the many to many relationship correctly and EF created the third table CustomerMovie with two FK's being CustomerId and MovieId both ...
1
vote
0
answers
46
views
Getting header as null in web api while requesting from MVC app but not in post man
I have two applications. One is .Net 6 MVC and the other is .Net 6 web api.
When I tried to request the end point from post man I am getting headers with JWT token as expected in my api app. But If I ...
-1
votes
1
answer
85
views
ASP.NET Web Api - return JSON response with space in property names [closed]
I want my ASP.NET Web API to return a JSON response with spaces in property names. Currently when I am testing it using Postman, I am getting response in this format:
[
{
"appId": 1,
...
-1
votes
1
answer
64
views
How i can resolve this problem with assigning roles
I cannot asign user to role in my web.api
I seeded my roles in the db in my Program.cs
using (var scope = app.Services.CreateScope())
{
var roleManager = scope.ServiceProvider.GetRequiredService&...
-1
votes
1
answer
105
views
Middleware order not respected ASP.NET Web API
So i 'm using two custom middlewares . One that validates the JWT Token on every request where it needs to be validated , and the one for the /admin routes . The problem is , even tho i specified the ...
0
votes
1
answer
49
views
How to insert a C# interface to a service class in DI container
I'm confused on how to pass on dependencies that come from the DI Container onto a constructor of a class.
I've got the following registrations:
public void ConfigureServices(IServiceCollection ...
0
votes
0
answers
22
views
Repeated requests via AJAX get slower and slower
Once I kept repeatedly inputting a character in the search box, it is getting slower and slower until it hangs. I wanted to optimize it and make it smoother.
Can you guys help me or give me any advice ...
1
vote
0
answers
73
views
httpclient returning data in encoding format
I have following code which return data from httpclient, but it looks like it's not giving data in proper json format.
Below is code and response.
HttpClient client = new HttpClient();
client....
1
vote
0
answers
550
views
Fastendpoints Validator with injected constructor
I'm trying Fastendpoints for organize endpoints in a .net8 web-api project. I have configured validators as follows
Issue is when the app starts in local environment it shows the following fail ...
-1
votes
1
answer
129
views
Access to XMLHttpRequest at has been blocked by CORS policy It does not have HTTP ok status
I have an application which is developed in 4.8 framework and another application .NET 8.0. The one in 4.8 is where I am developing the API's and consuming in the other project. I added this in web....
0
votes
0
answers
94
views
In IIS + ASP.NET + Windows Debugger, Can't download symbol from the microsoft symbol server
I have built a REST API server that runs WinDbg.exe with IIS + ASP.NET.
IIS version: 10.0.17763.1
OS version : Window Server 2019
ASP.NET : .NET Framework 4.7.2
In the test environment that is not ...
0
votes
1
answer
29
views
HttpWebRequest: the underlying connection was closed: the connection was closed unexpectedly
While posting the data using WCF service, I'm getting an error intermittently in C#:
Underlying connection was closed
0
votes
1
answer
71
views
Does not contain a static 'main' method suitable for an entry point when running docker build
Does not contain a static 'main' method suitable for an entry point
using CountryAPI.Models;
public class Program
{
public static void Main(string[] args)
{
var builder = ...
0
votes
1
answer
104
views
WIX - Uninstall .NET 8 from bundle
I try to install and uninstall .NET 8 in my application. But I have a problem. Everything is good, aplication install and uninstall but I have problem with uninstall .NET Runtime and ASP.NET Core. ...
1
vote
2
answers
89
views
How to create custom parameter attribute FromActionArguments in C# like FromQuery?
I would like to create attribute that will tell that parameter should be filled from action arguments, not from query, route, header or body.
ASP.NET is already binding it correctly from ...
0
votes
1
answer
117
views
What is the difference between returning CreatedAtAction() and RedirectToAction in ASP.NET Web API?
I am wondering what is the difference between CreatedAtAction and RedirectToAction in ASP.NET Web API ?
When to return CreatedAtAction, and when to return RedirectToAction?
I got the same response in ...
1
vote
0
answers
31
views
Not Parsing Hindi When Converting HTML to Image in ASP.NET Core Web API
I am generating a card and downloading using api. One can enter a card number and card is generated and downloaded. But the card contains some hindi texts which is not rendering correctly in the ...
1
vote
0
answers
96
views
Send audio recording to a C# ASP.NET Web API
I'm attempting to record an audio file on the web using angular / typescript. I am able to successfully record the audio and listen to it with the audio player. I am attempting to take that audio and ...
1
vote
1
answer
24
views
ASP.NET Web Api Model Binding From A Stream
Im trying to send a http post request from Action1 to Action2 and instead of sending the payload as string Im sending it as stream for performance. Im getting the error.
Unsupported Media Type
[...
1
vote
1
answer
75
views
How to view the image that is in the wwwroot of the asp.net core api over the internet
I created an asp.net core api that some of the payload accepts images.
These images are stored in wwwroot/image of the application's folder, and the absolute path is stored in the database.
When ...
0
votes
1
answer
547
views
How come an upgraded ASP.net Core 6.0 to 8.0 App isnt automatically able to use the User Secrets Configuration Provider?
I have upgraded my ASP.NET Core app from version 6.0 to 8.0. I have upgraded all the nuget packages.
I have a Secrets.json file in Connected Services in VS 2022. I have the "ConnectionStrings....