1,050 questions
1
vote
3
answers
289
views
Multiple actions were found that match the request in Web Api using Attribute Routing
Out of curiosity, I was trying to build API with the number of overloads.
Initially, I was getting the below error
-Multiple actions were found that match the request in Web Api
But again, I wanted ...
0
votes
1
answer
232
views
How to retreive all the properties of an object which is inside another object with C# code?
I have these three tables in SQL Server:
Evaluations (id, textreview, stars, userId, BookId)
Books (id, title, ..., userId)
Users (id, name, ...)
And I have this code to get data ...
0
votes
0
answers
358
views
Error :No HTTP resource was found that matches the request URI 'http://localhost/api/test'
I have a webapi project with a base ApiController named TestController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web....
0
votes
1
answer
365
views
Creating a Post Route with ASP.NET CORE 2.0 WebAPI parameter is null
I'm sending POST from PostMan:
And the parameter keeps coming up as null. From what I read, changing Post([FromBody]Models.Question value) and setting the model should be able to handle the json ...
0
votes
0
answers
73
views
ASP .NET WebAPI and correct routing
There is a WebAPI v1 controller with the following set of methods:
public class MailMessagesController : ApiController
{
[HttpPost]
[ActionName("Attachments")]
public ...
3
votes
2
answers
3k
views
Razor Page Routing in the same way as in Web API
I create a web application with Razor Pages.
I have 2 Models with one to many relationship: one List can hold many Records.
public class List
{
public int ID { get; set; }
[StringLength(25,...
1
vote
1
answer
149
views
C# MVC dynamic Route based on config
Is it possible to have a dynamic route name so that route name can be read from a config file?
e.g. where someStringReadFromConfig would be populated from a config file.
[Route("api/v1/test/"+ ...
0
votes
0
answers
228
views
How to use a WebApi in combination with a redirect uri with a GET response? ASP.NET MVC, C#
I am new to StackOverflow so if there is a right answer to my question below, I just didnt know what to look for..
I am currently working on a call to a API which works in the following matter:
Send ...
0
votes
1
answer
70
views
Extending API in one project fully exposes referenced API but routes clash
I'm trying to split a Core 2.1 WebAPI project into two in order that we can expose two different APIs according to circumstances. Simplified, we have one API and we want all the read-only (GET) ...
1
vote
2
answers
809
views
Organising WebApi Controllers under a single root folder and routing to them
Background
In most MVC and WebApi applications we typically see the following structure:
/Controllers
HomeController.cs
/Models
Typically this is generated from the MVC template.
This will then ...
1
vote
1
answer
1k
views
Angular / Web API unable to communicate on endpoint
I'm running into an issue where Angular is unable to make a successful request on 2 of 3 endpoints but I have confirmed all work with postman and that the proxy is successfully routing the calls. ...
4
votes
2
answers
6k
views
How to set default swagger welcome page in Web Api
I have created a Web Api, and I want to set default landing url as Swagger url i.e:-
http://localhost:65347/swagger/ui/index
2
votes
1
answer
436
views
DelegatingHandlers not executing when routes not defined
I am working on a WebAPI 2 project which currently uses attribute-based routing exclusively, to the point that there are no routes defined in registration, and everything is working as expected.
...
1
vote
2
answers
2k
views
Is it OK for multiple REST API methods to share same controller class?
Is it best practice to put each distinct Get method in its own controller class, or is it perfectly fine to have multiple (related and non-related) API methods in the same class, if the methods are ...
1
vote
1
answer
6k
views
How to get input parameters from HttpRequestMessage
I have created a class that inherit from DelegatingHandler and overwrite the SendAsync method. I wanted to validate the request parameters and encode them with AntiXss class before passing it to the ...
0
votes
1
answer
3k
views
Custom Actions in ASP.NET Core Web API
I am using ASP.NET core 2.0 Web API Template and I have a couple of doubts:
1)How can i create custom actions and map the URIs to them. Like I have an Employee Model and I want to create an API ...
-1
votes
1
answer
246
views
Getting error while calling WebApi
I am trying to create an API and trying to access it via chrome, expecting it to return the list of Items
public class ProductController : ApiController
{
Product product = new Product();
...
1
vote
2
answers
293
views
Getting HTTP 404 not found error while invoking action method
Please find the below details of my application
public class CartController : ApiController
{
[HttpGet]
public Response<CartDto> GetById(Guid customerId)
{
....
}
}
In ...
8
votes
1
answer
2k
views
Web API Versioning With Inheritance
I am trying to get Web API versioning working with an inherited class. I am working with two very simple variations of the stock Values controller.
[ApiVersion("1.0")]
[RoutePrefix("api/v{version:...
0
votes
1
answer
655
views
How to pass Date and time for HTTP GET API
I am trying to pass Date and time to HTTP GET API. It works well with just date.
But I get following error when i try to pass time along with it.
"A potentially dangerous Request.Path value was ...
0
votes
1
answer
175
views
ASP.NET Routing problems when ii have same methods name with different params
I have a problem with routing, since I created "BaseController".
I use only 4 methods name GET, POST, PUT, DELETE, to make easiest calls from front-end.
So, when I have this controller:
[RoutePrefix(...
1
vote
0
answers
2k
views
Web API Query string and the question mark?
Making the first API with the sample code from ASP.NET Web API:
In the WebApiConfig.cs, there is a route template:
routeTemplate: "v1/{controller}/{text}",
defaults: new { ...
0
votes
0
answers
638
views
MapHttpRoute to the Swashbuckle Swagger UI to use custom handler
I've got Swashbuckle going in my web api project. I want to get a custom handler invoked only when a user tries to hit the swagger ui page. I don't want to add the handler to the pipeline.
I thought ...
6
votes
2
answers
7k
views
Attribute Routing for querystring
I have below route URL:-
www.domanname.com/subroute/GetInfo?param1=somestring¶m2=somestring
I have function in webapi as:-
public class HomeController : ApiController
{
public object ...
0
votes
1
answer
106
views
Model is null while POSTing to web api using fiddler (test)
Hi I have the below Model class for my project. I am trying to get Form values in my WEB API POST method in Values Controller, however the values received are null. I am here for your suggestion on ...