Skip to main content
Filter by
Sorted by
Tagged with
2 votes
3 answers
2k views

I want to support all 3 of the following content-types in my controller/action. application/json application/x-www-form-urlencoded multipart/form-data with this signature i can support both ...
9 votes
2 answers
12k views

GET :http://www.Example.com/Api/1/0/Book/Company/0 [Route("{UserId}/{Category}/books/{BookType}/{Page}")] [HttpGet] [RequestAuthorization] public Response Get(int UserId,string Category, ...
218 votes
15 answers
223k views

The two entities are one-to-many relationship (built by code first fluent api). public class Parent { public Parent() { this.Children = new List<Child>(); } public int ...
1 vote
1 answer
68 views

Web API + NextTS Backend [Route("GetByPatient")] [HttpGet("{id}")] public async Task<ActionResult<List<Booking>>> GetByPatient(Guid id) { Debug.WriteLine(id);...
0 votes
0 answers
77 views

I am in the process of updating one of our systems to use System.Text.Json rather than Newtonsoft.Json. I have a Data class that I have amended to use System.Text.Json. This handles calls from MVVM ...
11 votes
1 answer
3k views

can anybody explain me what is the difference between UseOAuthBearerAuthentication and UseJwtBearerAuthentication? Why should i use 'UseOAuthBearerAuthentication' over 'UseJwtBearerAuthentication' or ...
3 votes
2 answers
8k views

I have two web API controllers: PageController and BlogController. They contain simple crud for creating pages and blogs. Every time I create a blog, I need to create a page, but not vice versa. Whats ...
3 votes
1 answer
6k views

I already write a Web API method, now I want to get a client website URL who used my API method. I tried this line of code but I get my API URL. But I want a client URL. var requestUrl = Request.Url;...
33 votes
6 answers
45k views

I am trying to send an HTTP request from my Blazor app to my ASP.NET Core API. I have breakpoints everywhere. The application gives an exception right after the action method on the API controller ...
3 votes
1 answer
2k views

I have a file being uploaded using http post request using multipart/form-data to my class that is extending from ApiController. In a dummy project, I am able to use: HttpPostedFileBase hpf = ...
17 votes
3 answers
11k views

I am developing a web API for my website and have ran into a problem. At the moment, the API is supposed to return details from the specified user. This is my controller for accounts: using System; ...
1 vote
1 answer
1k views

I have data in my apicontroller in following way- public class OutletPOCController : ApiController { OutletPOCContext db = new OutletPOCContext(); [System.Web.Http.ActionName("GetTabText")] ...
0 votes
1 answer
302 views

I upgraded a web API in .NET Framework 4.6 to 8.0 web API Core and got an error message from the IsAuthorized method: The type or namespace name 'HttpActionContext' could not be found (are you ...
0 votes
1 answer
2k views

Is it a good idea to use Web API to run background jobs where each job can take between 1-4 hours to complete? Problem: sometimes I noticed that the job restarts when a worker process is recycled. Are ...
0 votes
0 answers
41 views

There is a new requirement from the management to allow some specific list of users to update some app settings in the web.config of an ASP.NET Web API project (running on .NET 4.8 and hosted in IIS ...
2 votes
3 answers
3k views

(a) var person = repository.GetPerson(id) return person; (b) var person = repository.GetPerson(id) return Ok(person); According to the developer tools the result is the same and the status code is ...
-1 votes
2 answers
86 views

I've been trying to send a 'forgot password' email for my website. I am using a template html file with replaced text to send new randomized credentials to a user. I have so far been unable to send ...
0 votes
1 answer
86 views

I want use AMQP connection string. I want to create a single shared connection (and channel per app lifetime to avoid resource exhaustion.
0 votes
0 answers
39 views

I am trying to generate a sitemap.xml file form MAUI hybrid app in C#9 I have created a sitemap1 page which renders a static sitemap but I am getting error. @page "/sitemap1" @inject ...
72 votes
12 answers
73k views

I have API where I need to validate my user model. I choose an approach where I create different classes for Create/Edit actions to avoid mass-assignment and divide validation and actual model apart. ...
2 votes
0 answers
2k views

Given the following model public class User { public Guid Id { get; set; } public string Name { get; set; } public string Address { get; set; } } and lets assume the following as it's ...
147 votes
7 answers
94k views

In ASP.NET there is a System.Web.HttpRequest class, which contains ServerVariables property which can provide us the IP address from REMOTE_ADDR property value. However, I could not find a similar ...
1 vote
1 answer
3k views

I have a Web API backend with EF and use AzureAD to authenticate my (office365)users of the web application that is written in AngularJS. Now I want to create a draft mail in my Web API but I don't ...
24 votes
15 answers
89k views

I've been implementing IdentityServer4 to provide authorization for my React application. I have this working in my local dev environment, but am running into issues after deployed to IIS in Windows ...
13 votes
4 answers
20k views

I have created a filter which inherits the System.Web.Http.Filters.ActionFilterAttribute in the asp.net web api and would like to access some of the data inside the HttpActionExecutedContext result ...