Skip to main content

Questions tagged [asp.net-web-api]

ASP.NET Web API is a framework for building HTTP services for clients like browsers and mobile devices. It is based on the Microsoft .NET Framework and ideal choice for building RESTful services.

Filter by
Sorted by
Tagged with
1 vote
1 answer
52 views

Handling HTTP requests in existing Web Api

I am working in a Web Api project that has the following project structure: Root Controllers Orchestrators Managers Services etc The ...
Yiannr's user avatar
  • 119
1 vote
1 answer
221 views

Concurrent Requests Handling in ASP.NET Web API 2

I was having concurrency issues with my ASP.NET Web API 2 project with .NET Framework 4.6.2. (EF 6), although it has been live on production that has been running for more than 1 year, this problem ...
raysefo's user avatar
  • 197
3 votes
0 answers
93 views

Building an API for an e-commerce system to allow third party software to import products

I am working on an e-commerce website called Shopless, which is similar to E-bay/Gumtree. Our website integrates with other DMS systems, in order to allow organisations to import products into our ...
Hooman Bahreini's user avatar
2 votes
2 answers
446 views

Decrypt incoming HTTP request headers

During each HTTP request incoming from my Angular front-end I send encrypted pair of access & refresh token. On the back-end ASP.NET web APIs are used. The way I decrypt them currently is by ...
Andrеw's user avatar
  • 21
1 vote
1 answer
134 views

Azure DevOps Git: Fork into another Repo using Azure DevOps REST API

In my Azure DevOps Project, I have a Git repository that I would like to copy to another Azure DevOps Project. In other words, I should be able to copy the original repo into other Azure DevOps ...
Mugil Karthikeyan's user avatar
3 votes
1 answer
258 views

Export and import work items from Azure DevOps

I'm working on an application that exports and imports work items from Azure DevOps. To import work items into Azure DevOps, I have written the following code. Would you be able to review and make ...
Mugil Karthikeyan's user avatar
0 votes
1 answer
1k views

Is it optimal way to filter records from table using Entity Framework?

I have the SQL Products table migrated from MongoDb and I use ASP Core + MediatR. The filtering data comes from frontend ...
user2771704's user avatar
3 votes
0 answers
633 views

Async FIFO processing of database writes - naive implementation in .Net 6

One of the companies I was recently interviewing with gave me a following task to implement in a day or two using .Net, just to see where my coding abilities are at: Implement a Web API that gets ...
mi105's user avatar
  • 31
2 votes
2 answers
1k views

ASP.NET Web API for currency

On the basis of the daily exchange rate data of the CB (https://ww.cbr-xml-daily.ru/daily_json.js) it is necessary to create a Web-service using ASP.Net Core, which implements 2 API methods: ...
Aarnihauta's user avatar
1 vote
1 answer
2k views

Having both bearer token and basic authentications

In my asp.net web API, I have a couple of controllers. In one of my controllers, I am using basic authentication and in another one, I am using bearer token authentication. It is working as it is ...
raysefo's user avatar
  • 197
0 votes
1 answer
597 views

ASP.NET Web API 2 reading values from config file or database or elsewhere

In my asp.net web API 2, I am reading values from web.config from the controller into my DTO as a response to the client. It is working as expected, I wonder if there are any improvements to make it ...
raysefo's user avatar
  • 197
0 votes
1 answer
4k views

Web Api to upload excel file

I work on asp.net core 2.2 web API using C# language I need to rewrite function below with best syntax and with best practice web API below get Excel file from upload and return Excel file it working ...
ahmed barbary's user avatar
2 votes
2 answers
174 views

Dapper with shops and payers

I live in the buildings that have 50 people in it and for each floor splits into 2 groups each group is from ~9 people. I'm trying to build an Xamarin app (IOS, ANDROID ,Win10,maybe web app) to make ...
rynex akil's user avatar
3 votes
1 answer
148 views

Calling multiple clients from API controller methods?

Hi I have a requirement where in I have to call two different client methods from same api in .NET Core and I have structured my code as follows. THis is working fine but Please give me your ...
chiru1983's user avatar
0 votes
1 answer
7k views

Generic Wrapper class for HTTPClient methods

I am trying to using HttpClient for making API calls from a different domain and for that purpose I have created the following service class after doing some research. It is 4.7.2 framework and not a ....
chiru1983's user avatar
2 votes
0 answers
595 views

How to make a good session handling with NHibernate?

here I leave my code for a repository pattern with NHibernate and Autofac. I would like to receive some feedback about it. Especially about the session handling with NHibernate. By now I don't like ...
biel sala's user avatar
0 votes
1 answer
2k views

Making a generic web API controller when using multiple tables with similar fields

I have been trying to refactor my code since I found I've been doing a lot of copying and pasting to implement the logic of the web API controllers. Here's how the controllers looked like before ...
Youssef Ashraf's user avatar
2 votes
0 answers
522 views

How to use single child Unity container for OWIN middleware and WebAPI

I am using OWIN to self host a WebAPI service. There is Unity to serve as an IoC container. Within several OWIN middlewares (e.g. authorization layer) as well as in WebAPI I need to access a Unity ...
Ondra Netočný's user avatar
5 votes
1 answer
706 views

Parallel Calls to External WCF Service - ASP.NET Web Api

I have come across a situation where I feel running some code in parallel will greatly improve performance, but I am concerned about the implementation and am looking for some confirmation. Take the ...
ZMJ's user avatar
  • 51
7 votes
3 answers
2k views

C# Am I using proper SOLID principles?

I am currently practising using the SOLID principles in C#/.NET I have made a little example, but i am not sure if i have followed it correct. Its a simple example where i have an API controller that ...
Martin C's user avatar
  • 130
2 votes
1 answer
214 views

ASP.NET Web API Authentication For Xamarin App

I've recently been learned how to implement a token based authentication with ASP.NET and I would love to get some input on how my code & structure is as well as how I can make it better. The code ...
AcePilot10's user avatar
2 votes
0 answers
47 views

API Layer ClientId and Security style

Im at the point where I am designing my api security and I was going with a custom attribute I don't want to use third party systems as they cost money. I was going to use the client id and the ...
dotnetdevcsharp's user avatar
1 vote
0 answers
69 views

Concurrent requests are not permitted in specific time period

In my web API, the client wants me to implement logic in order to control/block concurrent requests in a specific time period. I added RequestInterval which is 10 seconds in the appsettings of web ...
Fake Developer's user avatar
2 votes
1 answer
824 views

Handling external API calls status code in my application

I have a Web API application in .NET Core 3.1. In a controller I have a GET action that must return a JSON object with a name and a description. In order to retrieve the correct description I need to ...
Sara's user avatar
  • 23
2 votes
0 answers
579 views

Web API get data with many optional parameter in .NET Core

I would like to do a refactoring of web API implemented in .NET Core. The Goal is to simplify ...
Raskolnikov's user avatar
3 votes
2 answers
199 views

Asynchronous catalog with paging and partial views

I'm trying out .net core with mvc in a personal project, the latest functionality I've added was a project catalog, primarily ajax based, it's displaying a list of projects fetched from the database ...
Denis's user avatar
  • 8,458
2 votes
0 answers
332 views

Retry HttpClient request without handlers

I have a server and client application. In the client application, there are HttpRequestException class exceptions on requests. As it seems to me - these exceptions happen in isolated cases and not ...
Александр Пекшев's user avatar
1 vote
1 answer
1k views

Filtering items in an ecommerce site with asp.net mvc and ajax

I'm trying to filter items from an ecommerce site.The project on the local server was running smoothly.However, I noticed significant delays since the project was published on the global server.Most ...
Elxan's user avatar
  • 53
2 votes
1 answer
388 views

Active Directory security groups Search application optimization

I have a Web API method that returns the Active Directory security groups for the specific login user. The below code was working fine but it was taking so munch time nearly 45 sec to get the results....
TARUN's user avatar
  • 121
2 votes
0 answers
627 views

Stream JSON from Azure Cosmos DB to browser in Web API

I have an HTTP endpoint for returning data directly from Azure Cosmos DB. The endpoint is basically a database access point (this seems like a common case). Since I'm returning the data unmodified, ...
Scotty H's user avatar
  • 133
4 votes
2 answers
3k views

Calling rest API with HTTPWebRequest

I am calling a rest API as follows. I wonder if there are ways to improve/optimize the code. Should I add time-out or cancellation token? Any help would be appreciated. ...
Fake Developer's user avatar
1 vote
0 answers
92 views

Subscribe once and reuse the Angular Subscription each second

I am creating a web application using Angular 8. This application is all about talking to the stock markets server and getting the Live updates every second. I have one query here. Below is my code: <...
Rahul's user avatar
  • 11
2 votes
1 answer
717 views

Asp.net web API Nlog implementation with UnhandledExceptionHandler

I have an asp.net web api. I would like to log errors into a file. So I decided to use NLog. I already have UnhandledExceptionHandler so I added NLog as follows. I removed all the try/catch in order ...
Fake Developer's user avatar
6 votes
1 answer
220 views

Custom HttpClient implementation for third part usage with sync/async calls

I'm doing an implementation of HttpClient that is built in a NET Standard project, which will be used as a base to build and process JSON requests/responses for a third part REST API. Client is built ...
user avatar
2 votes
1 answer
148 views

418 I'm a TeapotServer for RESTful integration-tests

I created a test-server for RESTful integration-tests that I call TeapotServer because I like the status-code 418 that the ...
t3chb0t's user avatar
  • 44.3k
2 votes
1 answer
128 views

Exception, errors handling, best practice in WebApi Core

I'm making my WebApi project. My logic is, the controller didn't see data. It only triggers a service that returns objects to it. My simple method from ...
metadon789's user avatar
2 votes
0 answers
1k views

Ninject binding for Dbcontext

I have an asp.net web API and I am using EF6 to connect to a third party rest API which sells online game codes. We made a deal with the company so clients have to call my rest API in order to get the ...
Cenk's user avatar
  • 21
1 vote
1 answer
120 views

Login flow in app

I made the login flow without any reference to a tutorial. So I want some feedback. Basically it sends username and password in a POST request to /token. The app stores the tokens on device, then ...
Jam's user avatar
  • 347
1 vote
0 answers
318 views

Converting IActionResult to something that can be mapped in JS

I have the following ReactJS unordered list which is generated from answers: ...
okThen's user avatar
  • 11
3 votes
0 answers
2k views

Controller in an ASP.NET Web API application which generates a CSV file

I have a controller in an ASP.NET Web API application which generates a CSV file. The controller looks like this: ...
StepUp's user avatar
  • 553
1 vote
0 answers
371 views

Design Web API with Command Handler

I'm setting up new API to Setup LocalAccounts and need your advice on how to design the API with CQS some background : LocalAccount Is Account that related to ...
mreizik's user avatar
  • 11
2 votes
0 answers
175 views

Web API CRUD Demo with Console App and MVC Web Application

I have created a simple CRUD method using Web API project which consumed by 2 platform: Console App and MVC Web Application. The EntityModel project is mainly the entity and the DAL layer. Is my ...
Steve Ngai's user avatar
1 vote
0 answers
233 views

Transparent proxy using HttpClient

I'm looking for feedback on some code I've written to work as a transparent proxy. I'm developing a web app that needs information from another web site's API, but that web site has disabled CORS and ...
rad-b's user avatar
  • 11
2 votes
0 answers
1k views

Repository + Unit Of Work Pattern in WebAPI

I am refactoring my existing product's webapi part of the solution. Current Repo pattern does not allow me to add custom functions to a specific repository. In result, most of the functions directly ...
Akhil's user avatar
  • 121
2 votes
1 answer
1k views

WebAPI global exception handler

There is a global exception handler in our WebAPI application that looks like the following: ...
TomSelleck's user avatar
3 votes
1 answer
71 views

Create objects corresponding to whichever field has value from among a list of fields

I have to create a form, which enables users to move stock of items to different statuses. The form will show the current stock(quantity) in a given status and then 5 input fields corresponding to 5 ...
stonemusic's user avatar
1 vote
2 answers
872 views

Design Pattern to Add, Edit and Delete Records

This code allows Add, Edit and Delete a database record for the Category table. Separate Service classes are implemented to handle these operations which are called ...
Coder Absolute's user avatar
3 votes
2 answers
208 views

Subscribe to Event form one service to another

In my architecture I have service layer, and for my question two relevant classes in this layer: UserManagementService EmailSenderService In first service there is method: ...
hyperN's user avatar
  • 231
2 votes
0 answers
41 views

Looping JSON to get matching values from Database

I have a need to take in a payload that looks like this: ...
VinnyGuitara's user avatar
6 votes
3 answers
21k views

ASP.NET REST controller with try-catch error handling

Yesterday someone guided me through this article and I'm wondering whether I should use try-catch implementation or not? I have the following code below which is actually a RESTful service and I have ...
Sahil Sharma's user avatar