Skip to main content

Questions tagged [asp.net-mvc-web-api]

Filter by
Sorted by
Tagged with
0 votes
2 answers
713 views

Best practice ASP.NET MVC share code with Web API

I'm trying to develop an ASP.NET MVC-application with an additional Web API. To reduce code-duplication, I'd like to share as much code as possible, but with the possibility to differentiate between ...
Sam's user avatar
  • 65
0 votes
1 answer
107 views

API Routes: Get App by User or Get User's App

We have a .Net WebApi 2 we've been working on for quite some time. As we refactor code, we started thinking of what might be a better practice: a) "to get an app by userid", or b) "to ...
RoLYroLLs's user avatar
  • 119
-2 votes
1 answer
370 views

How often should I request a token when communicating with a third-party API?

I have an ASP.net web API. I would like to call another API that has an authentication token inside my API. The code flow is as follows: My API is called → Get authentication token from 3rd party API →...
raysefo's user avatar
-1 votes
1 answer
1k views

Can I call a WCF endpoint from ASP.Net Web API?

I have a web api with controller methods that use rest http(post/get calls). Clients consume this API with normal httpclient calls and I pass an http response back. My use case is I have a legacy ...
Terrance Jackson's user avatar
1 vote
0 answers
422 views

SignalR Handle Multiple Clients in my Scenario

I currently have multiple clients who need to be informed when a customer creates a new order. Each customer is registered to an individual client and customers create orders on my website (each order ...
pinman's user avatar
  • 11
1 vote
4 answers
3k views

Should you validate route parameters or let them fail with a 404?

So this is an example endpoint to fetch one user by its username [HttpGet("{username}")] public async Task<ActionResult<object>> GetUser([FromRoute] string username) { // ... ...
Question3r's user avatar
4 votes
1 answer
1k views

How to authorize and store user login from a xamarin frontend to a asp.net core api

So I suppose this question isn't as much as a 'How to' but a 'which way' kind of question. So I have a .net core api backend that makes calls to a dB I also have a xamarin forms project that ...
dros's user avatar
  • 167
8 votes
2 answers
2k views

Separation of concerns and other best practices across Controllers, Services, Providers and Stores in ASP.NET when building a REST web api

I am traditionally a desktop app developer, but circumstance has thrust me into the role of doing web client and corresponding REST api logic for a project I am involved in. Unfortunately, I'm a one-...
Geo...'s user avatar
  • 181
-3 votes
1 answer
343 views

What is the simplest version of best practice application architecture for a backend in C# and ASP.NET Core WebAPI?

I know that in some contexts, best practice would be DDD, CQRS and EventSourcing, but in my case this would be too complicated of two reasons: My team is beginners, and we want them to be productive ...
Terje Kolderup's user avatar
-3 votes
1 answer
174 views

A True RESTful API | Help needed

I know that a RESTful would have unified API and it treats everything as a resource (a noun, example a book, a product,...) and it can be applied with CRUD operations using HTTP Verbs (GET, PUT, POST, ...
Ashokan Sivapragasam's user avatar
1 vote
2 answers
2k views

Should an ASP.NET Web API application use Entity Framework in the API controllers?

Im a bit confused about what is best practice when working with Entity Framework and ASP.NET Web API. I am working on a project that contains a iOS/Android app and an API the app will use to ...
Martin C's user avatar
0 votes
2 answers
1k views

Why should I use REST API?

I somehow get the point of REST API, like for example you want to get the list of customers to the database server, you have to request a GET method and the server will throw a response with a ...
Maxim Cruz's user avatar
0 votes
0 answers
914 views

Separating models in a Backend-For-Frontend (BFF) API

At the moment I have a frontend client calling several backend REST APIs. For example a call may be to get information about a certain vehicle. Then the client will call REST API A to get some ...
Force444's user avatar
  • 643
0 votes
0 answers
148 views

Authenticated ASP.NET Core MVC site consuming web API

I have an ASP.NET Core 2.2 MVC site, that uses Facebook as an identity provider. Users can click the login button, they are redirected to Facebook to enter their credentials, and are then redirected ...
L-Four's user avatar
  • 333
0 votes
0 answers
702 views

Running multiple MVC projects: One site

I am developing a "platform", I have an MVC site that will hold all the main data, as well as our generic API, uses Microsoft authentication to create an account, then our employee MVC will add the ...
NateThompson114's user avatar
0 votes
1 answer
284 views

How to manage model(s) between web client (DMZ) and web API?

I have this web API project which handle all database access via entity framework. I have another web client reside in DMZ to call those APIs (via ajax or c#) in the web API project. When I make API ...
Pop's user avatar
  • 219
-4 votes
1 answer
380 views

When designing a web application with Vue.js and ASP.NET Core, is ASP.NET solely for the API?

When creating a web application from scratch with ASP.NET MVC Core (using Visual Studio 2017) and using Vue.js, is the MVC Core part of the application solely for the API? What other function would ...
johnny's user avatar
  • 3,679
12 votes
2 answers
18k views

Should integration tests use database? [closed]

I know that integration tests test parts of project that interaction with each other somehow. And I need to test this interaction. And there is the question: 1)Should these tests use real database ...
NoImagination's user avatar
2 votes
1 answer
3k views

Calling executables from an ASP.NET WebAPI

I have an Angular application with a table, and I'm considering having the console application take the name of C# programs that the user can run. I was thinking of passing the name or code of the ...
rds80's user avatar
  • 131
2 votes
1 answer
1k views

Onion Architecture, Project Architecting and Authentication

I am learning ASP.NET MVC & Web API and trying to implement Onion Architecture with Repository Pattern for one of my Test projects as part of my learning. I have developed single MVC Projects ...
RollsReus's user avatar
1 vote
2 answers
1k views

Putting it all together - DDD, CQRS, Web API

I need some expert guidance. I'm trying to learn the concepts as well as implement them, and it's possible I might be over-engineering some. But that's OK, because I am wanting to learn and gain ...
user1560457's user avatar
3 votes
2 answers
4k views

Stateful authentication in REST API using tokens

I have recently started on a project involving a REST API. The API requires authentication with requirements for administrators to be able to view logged in users and to be able to revoke specific ...
AnotherGuy's user avatar
-1 votes
2 answers
67 views

What should be the REST API (URL) for a user to be assigned to multiple territories

In our application we have a user who can be assigned multiple territories. What is the best way to expose the REST API? Should it be as : [POST] www.xyz.com/Territory/User OR [POST] www.xyz.com/...
Rahul Jain's user avatar
2 votes
2 answers
4k views

ASP.NET Web API and MVC Architecture for Web Application

We have a single solution Visual Studio web application with multiple projects. One of the projects (Services project) has APIs for our App clients (Android/iOS). There's separate project for MVC ...
maverick's user avatar
  • 341
0 votes
2 answers
586 views

Wait time created by having separated REST API and web application

I created a new Asp.Net MVC web project. I took the decision to create two different apps, the first one would be a web REST API that would provide all data for the second one, which would essentially ...
Nicolas Boisvert's user avatar
0 votes
1 answer
1k views

Pattern for web service response caching, but only use the cache for when the data store goes down or request otherwise would fail

We have a REST web service written in C# in ASP.NET MVC/WebAPI. When the underlying data store fails, this can lead to our service being completely unavailable, instantly. There is currently no ...
Luke's user avatar
  • 109
3 votes
2 answers
9k views

Web API - strong classes or dynamic?

My web api method should return some structured data about my profile. To do it I created the following POCO classes: public class ProfileInfo { public string FirstName { get; set; } public ...
user285336's user avatar
0 votes
2 answers
2k views

Integrate Web API Services with multiple authentication services

In a multi-tenant deployment of Web application, How can the Asp.Net Core Web API services be designed to work with different authorization services? The Web applications use OAuth and JWT Bearer ...
KDR's user avatar
  • 153
1 vote
1 answer
528 views

Creating JWT token internally

I need to implement JWT tokens in my ASP.NET Core API app to handle authorization. My question is, what is the risk of generating my own JWT token within my API app as opposed to having it handled ...
Sam's user avatar
  • 413
1 vote
2 answers
1k views

Connect to different database based on URL

I am developing a SAAS application where : A single web application is hosted in IIS which will serve to multiple companies and each company will have its own database. The web application and ...
Rahul Jain's user avatar
2 votes
1 answer
309 views

What features are missing from WCF Rest Implementation

In this question about using WCF and/or WebAPI, there is this quote: I was asking myself the same question until I found this WCF and ASP.NET Web API comparison page on MSDN (with my own emphasis ...
WernerCD's user avatar
  • 812
-1 votes
1 answer
799 views

Should I use the same solution for WebAPI and autogenerated client for it?

I have the following situation: ASP.NET Core WebAPI solution which uses Swagger Automatically generated client for WebAPI using Autorest, extended with custom authorization. This client also will be ...
Ihor Korotenko's user avatar
2 votes
4 answers
7k views

Web API - How to prevent the POST-ing of entities with custom Id values

Let's say I have the following model: public class Product { public string Id { get; set; } public string Name { get; set; } public string Category { get; set; } public ...
kylemart's user avatar
  • 153
2 votes
2 answers
5k views

Asp.net mvc web api model validation best practice

I have an annoying code smell in my asp.net core api that I am passing around, and I can't come up with a way to fix. In an MVC controller action, usually there is a very straight forward logic, at ...
gilmishal's user avatar
  • 271
0 votes
1 answer
521 views

Use of iFrame to avoid IE oddities

I'm working with a team on an ASP.NET MVC C# EF application that needs extensive Help materials. The Help materials will be stored on a helpdesk site (FreshDesk) so they can be accessed as a ...
wayfarer's user avatar
  • 195
0 votes
2 answers
1k views

Asp.Net Mvc 5 / Web Api 2 unit testing data access layer

Let's say I have IRepository interface implemented by Repository class(uses database context to implement IRepository methods). And IUnitOfWork interface implemented by UnitOfWork class using ...
David Maisuradze's user avatar
7 votes
3 answers
37k views

Is it okay to have multiple get action methods in ASP .Net Web API controller according to RESTful API constraints?

I have the following interface in my business layer public interface IUserService { void CreateUser(User user); List<User> FindUsersByName(string searchedString); ...
Mykhailo Seniutovych's user avatar
1 vote
1 answer
1k views

Dotnet (.NET) core MVC WEB API SPA Project and Solution Structure

I am building a new simple web application using dotnet core (.NET Core) and Angular SPA. Does it make sense to split API and Web App into different projects? This would complicate things (...
agfc's user avatar
  • 121
1 vote
1 answer
381 views

Architecture for email service API

I would like to build an application for sending emails. So I chose ASP.NET Core (API) which will be deployed by Docker. The application will get some request and "do some things" and then sends ...
mskuratowski's user avatar
0 votes
2 answers
4k views

Entity framework vs pure ado .net in calling stored procedure in an enterprise project

There is an enterprise project, which all the business implemented in databases and in the stored procedures, and web API is just like a light wrapper which get the request and deliver it to proper ...
reza damavand's user avatar
2 votes
2 answers
937 views

Best technique for pushing many records and files to a system: WEB API or FTP

I have a website where users can upload manuals (PDF documents) for their products. Basically, they first add the product to the system and then add 1 or more manuals to that product. A manual can ...
Zeep's user avatar
  • 33
4 votes
2 answers
2k views

If I have ten objects, should there be ten controllers for a Web API?

Is it good design to have a controller for each object of your API? I know this is a short question, but it's really a fundamental question that I do not know. Say I have a school or a CRM. That is ...
johnny's user avatar
  • 3,679
22 votes
2 answers
12k views

Isn't CQRS overengineering?

I still remember good old days of repositories. But repositories used to grow ugly with time. Then CQRS got mainstream. They were nice, they were a breath of fresh air. But recently I've been asking ...
SiberianGuy's user avatar
  • 4,813
2 votes
1 answer
3k views

What is a good technique for supporting sorting and filtering with a REST WebAPI

I'm in the process of developing an ASP.NET Core WebAPI that uses EntityFramework to access the datastore. One of the things we need to support is sorting and filtering. I'm assuming that the HTTP ...
Jake Shakesworth's user avatar
2 votes
1 answer
6k views

ASP.NET Web API: enum or strings

I have an ASP.NET Web API application. It uses enums for some fixed sets of states or types. Now I need to extend enum to support more values. But it will break backwards compatibility so I need to ...
Maxim Tkachenko's user avatar
4 votes
1 answer
396 views

Joining table with table from external database/API

For a prototype project I've created an Angular 2 application with simple CRUD functionality using Auth0 to handle authentication with a back-end containing a Web API (core), Service and Repository ...
Sam's user avatar
  • 171
1 vote
1 answer
143 views

In which order should page- and pageSize-parameters be used?

I'm building an api and a bit into the development I realized that I constantly change the order of the page and pageSize parameters. Currently I use C# and javascript, so the method declaration ...
smoksnes's user avatar
  • 483
3 votes
1 answer
781 views

Which is more secure for the DB, Web API or MVC with repository pattern & EF?

I am 1 of 3 developers. The other 2 use Web API and angular to build web apps. I prefer ASP MVC with a repository and EF. The stated argument is that a service is more secure when accessing the ...
BattlFrog's user avatar
  • 183
1 vote
1 answer
541 views

Consume ASP.Net REST API service

I am creating ASP.Net REST API application and stuck on the part where I should consume the REST service. I am not sure how to find the way let me accomplish the following: 1. I don't want it to be ...
Iglesk's user avatar
  • 113
0 votes
1 answer
245 views

How To Design Tiers For Web and Mobile App

The scenario is to have a Mobile App and Web App too. So currently I can think of two scenarios Which one do you guys think is better? PS : If needed I can also implement DAL Layer in both the ...
Krishnandu Sarkar's user avatar