Questions about routing within ASP.NET Web API framework

learn more… | top users | synonyms

0
votes
0answers
9 views

Why does my Web API / REST / Windsor code get routed in this direction?

I probably will not be able to provide enough information/insight for anybody to answer this question absolutely, but I'm hoping, by giving the best overview I can of the dilemma, to get thrown a bone ...
0
votes
2answers
23 views

Accept WCF request in WebAPI

I need to enable my webAPI REST service to accept a request in the format of: www.someURL.com/OldService.svc I am working on an existing application that used to use WCF. These methods do not have ...
0
votes
0answers
22 views

Web Api controller thinks it is duplicated

I have a webforms app, that has some Web Api controllers in it for integrations. Two are working just fine. But Today I wanted to add another controller. Should be simple enough, I add a new Web Api ...
0
votes
0answers
8 views

Can I create a route which redirects “/” to another folder with static HTML files in it?

I'm using WebApi, and have a route setup for "api/{controller}/{id}". But I also have the following folder structure in the project: \Static\index.html \Static\pageY.html I want the web site's ...
0
votes
0answers
12 views

Does marking a WebApi action with Obsolete have any effect other than within Intellisense?

We are currently experiencing an issue with our webapi implementation where an action returns a 404 in the QA environment. The code has moved through Dev and Int(egration) environments without fault. ...
1
vote
1answer
32 views

What would cause attribute routing to not work when adding it to an existing MVC 5 web app?

I added the Web API nuget and the StartUp WebApiConfig code that calls MapHttpAttributeRoutes via Global.asax, but none of the attribute routes are working. protected void Application_Start() { ...
1
vote
1answer
32 views

UrlHelper.Link() returns null

I know that there are a number of questions here that have this title, but, having been through them, I do not believe any of the posted solutions help. I have the following code in a Web Api v2.1 ...
0
votes
2answers
41 views

Partially match route in WebAPI Controller

Is there any way to match only the first part of a URL using WebAPI (attribute routing specifically). Something like a way to match multiple optional path components where the number is not known ...
0
votes
0answers
13 views

How to implement Web API Self-Host with Forms Authentication?

Can any explain or suggest a sample code to implement Form based Authentication(asking username and password from login page) with Web API Self Host App.
1
vote
2answers
38 views

Attribute Routing in Web API with RoutePrefix - Strange error

[RoutePrefix("ServiceRequest")] public class ServiceRequestController : ApiController { [HttpPost] [Route("")] public IHttpActionResult ...
0
votes
2answers
35 views

Is routes case-sensitive in Web API OData Service using ODataController?

i followed this to learn how ODataController works, everything is OK but when i changed the request uri from "localhost:49292/odata/Employees" //result: 200 to "localhost:49292/odata/employees" ...
1
vote
1answer
72 views

How to POST an entity complete with navigational relationship in Web API OData?

I'm using ASP.NET Web API with OData. I'm trying to POST a Child entity, which has a relationship to a Parent (the parent already exists). When I post the entity (using WCF data service client and ...
0
votes
2answers
42 views

ASP.NET Web API 2 - define controller-to-method mappings?

Microsoft has a good tutorial for getting your first ASP.NET Web API project going: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api ...but what's ...
2
votes
2answers
83 views

Linking to an MVC Route from Web API inside an in-memory server

I'm having problems testing the generation of MVC Routes from inside Web API. The code works when hit manually, but fails under test as the in-memory instance of Web API is unaware of the MVC routes ...
0
votes
2answers
46 views

API multiple Get methods and routing

I have a controller with only Get Methods public class DeviceController : ApiController { List<Device> machines = new List<Device>(); public IEnumerable<Device> ...
0
votes
2answers
54 views

Default API Route not working even without ODATA

I am running into a problem when I call /api/something/67545217-0fed-4058-9cfc-f6363412f5a2. It calls the get all. The other Get's work, but I think it is because they use the {action} in the url. And ...
0
votes
1answer
36 views

How to rout to a web api when calling another web api

I have ASP.Net web api2 odata service running as a separate project in our application server. Initially to consume this in our web server application we have used Breeze.js with angular and later we ...
3
votes
2answers
75 views

Is there a default verb applied to a Web API ApiController method?

I've been looking at the code (in https://github.com/patelsan/WebAPIAuthentication) from this article: http://www.codeproject.com/Articles/630986/Cross-Platform-Authentication-With-ASP-NET-Web-API. ...
0
votes
2answers
42 views

web api routing and http post [duplicate]

I'm building an API using WEB API 2. I have the following API controller: [RoutePrefix("api/account")] public class AccountController : ApiController { [Route("login")] [HttpPost] public ...
1
vote
1answer
50 views

Asp.net Web API Attribute Routing 404 Error

I cannot figure out for the life of me why my attribute routing isn't working. Here is my setup: public static class WebApiConfig { public static void Register(HttpConfiguration config) { ...
1
vote
1answer
45 views

Web API routing constraint Patch missing in HttpMethod

I am building some restful api using .net Web API V1. We are trying to define some routing for the web api. I am having some issue in defining the route for 'Put' and 'patch'. They have the same ...
0
votes
1answer
45 views

How to Auto generate URL based on attribute Route Url in Help page in WebApI

I am trying to display the Help page in WebApi, by displaying the URL and corresponding parameters. By using the following command in "Package Manager Console" I am able to generate Help page with ...
0
votes
1answer
25 views

Custom Attribute for the route

I want to create a custom attribute, for a parameter in my route. I can't use a "ParameterBindingAttribute" Before the "Do something", i want to verify the parameter myVar How to do this? ...
0
votes
1answer
35 views

Switching ASP.Net Web API returns between XML and JSON; where's it done?

I have an ASP.Net Web API project. In my controller is this simple 'boiler plate' API method: using System.Web.Http; public class DataController : ApiController { private static Random _Random = ...
0
votes
0answers
44 views

(Exception from HRESULT: 0x80131040)

I am Implementing WepApi Service with Rest but i am unbale to browse the url it's showing Could not load file or assembly 'MySql.Data.Entity.EF5, Version=6.9.0.0, Culture=neutral, ...
0
votes
1answer
68 views

web api 2.1 routing not working but same works on mvc

I'm sending multiple requests to the same action method in a controller all these requests have some common querystring attributes and some specific to that request. request1 : ...
2
votes
4answers
115 views

404 not found error when locally testing web api

This is my first time trying to use the WEB API in a project and am not having any success with it... I keep getting 404 errors when I try and reach my api route in Fiddler. I tried looking a lot on ...
0
votes
1answer
59 views

RouteTable.Routes vs HttpConfiguration.Routes?

I see that Webapi uses the RouteCollection from GlobalConfiguration and MVC uses from RouteTable. I saw an explanation in this link: Difference between RouteTable.Routes and HttpConfiguration.Routes? ...
2
votes
1answer
70 views

How do I make my API action accept null complex types?

So this works perfect //localhost:1234/api/task/getData?id=1&name=test&phone=123456 public object GetData(long id, [FromUri] User complexType) { //complexType is binding correctly ...
0
votes
1answer
71 views

What is the difference between the way routes are registered with MVC and Web API?

In my MVC and WebAPI application I see two different ways of doing routes. One for MVC which calls RegisterRoutes and passes RouteTable.Routes One for Web API which calls CustomizeConfig and passes ...
1
vote
1answer
27 views

Can I apply a MessageHandler to certain attribute routes?

I know you can assign a handler using convention-based routing, e.g: public static class WebApiConfig { public static void Register(HttpConfiguration config) { var tokenHandler = new ...
1
vote
1answer
51 views

Return 400 Bad Request if version specified in header does not exist

I'm writing a Web API and I'm implementing versioning using routing constraints, similar to how it is done in the Web API 2 sample which is located here. I have an implementation of ...
1
vote
2answers
67 views

WebApi Controller Get Action Doesnt Work

I am having trouble with one of my WebApi2 controllers. While writing tests I discovered the Get() is never hit instead it returns a 301 followed by 403. Oddly if I hit Get(id) the second action ...
3
votes
1answer
94 views

Attribute based webapi2 routing returns 404 for some methods

I'm presently working on a project that has been upgraded to Webapi2 from Webapi. Part of the conversion includes the switch to using attribute based routing. I've appropriately setup my routes in ...
0
votes
0answers
238 views

Use routes.MapAttributeRoutes and routes.MapHttpAttributeRoutes in ASP.NET WebAPI 2

I had developed a RESTful Web API 2 in ASP.Net. Had setup supports for AttributeRouting e.g. [Route("api/controller/method")] on individual methods in each controller. It worked perfect until I tried ...
1
vote
1answer
123 views

Attribute Routing and Query Strings

I am new to web api coming from a WCF background and as prep I watched Shawn Wildermuth's Pluralsight course on the subject before diving in. His course material was designed around more traditional ...
0
votes
2answers
52 views

Web API 2 Attribute Routing Clash

I'm having issues getting my head around how route selection works. I have two route attributes set which are clashing with each other. They Are ...
0
votes
1answer
66 views

Web API 2 404 Error when using jQuery Ajax

I have a Web API 2 that I am consuming using jQuery Ajax and looking through the documentation you can now include a route inside the Controller itself so you could include additional parameters ...
0
votes
2answers
472 views

No HTTP resource was found that matches the request URI error in ASP.NET Web API

This is a sketch of my TransferController class. All this is Web API code. public class TransferController : ApiController { [HttpGet, ActionName("Queue")] public IEnumerable<object> ...
0
votes
2answers
54 views

Method called a GET instead of POST

I have this 'POST' method [HttpPost] [System.Web.Mvc.ValidateAntiForgeryToken] public HttpResponseMessage UpdateProfile(string sAppUser) { MobileProfileModel profileModel= ...
0
votes
1answer
52 views

Web API 2: Added a new controller, it won't register?

Having a heck of a time here... (Web API 2.1, .NET 4.5.1) I had one controller that worked perfectly: [RoutePrefix("v1/members")] public class MembersController : ApiController { [Route("{id}")] ...
1
vote
1answer
145 views

IQueryable GET action / custom navigation property in ODataController

I'm working on a project which implements ASP.NET Web API OData controllers. I'm trying to create a custom queryable GET action on an entity, however after extensive search, I have not found a ...
0
votes
3answers
326 views

Multiple GET and POST methods in Web API controller

I have been struggling with this problems for days. I have a controller that need to have multiple GET and POST methods. Somehow I managed to achieve multiple GET methods in the controller. At that ...
1
vote
4answers
147 views

Query string not working while using attribute routing

I'm using System.Web.Http.RouteAttribute and System.Web.Http.RoutePrefixAttribute to enable cleaner URLs for my Web API 2 application. For most of my requests, I can use routing (eg. ...
0
votes
1answer
34 views

Why does my action method with default parameters cause a 404?

I've got a WebApi action method that does this: Public Function GetSomething(Id As Integer, Optional SomeValue As Integer = 0) As HttpResponseMessage I have the standard route in place: ...
0
votes
1answer
64 views

Attribute Routing gives 404 for api/delete/1

I am doing a SPA with web api as the backend and AngularJS as the SPA. I am using attribute routing in WebApi2. The problem is when I do any http request that matches the following skeleton, it ...
0
votes
0answers
22 views

HelpPage not documenting complicated routes

config.Routes.MapHttpRoute( name: "employee_w2s", routeTemplate: "api/employee/{guid1}/{guid2}/w2s/{id}", defaults: new { controller = "documents", id = ...
1
vote
1answer
320 views

Pass URL containing a query string as a parameter ASP.Net Web API GET?

I'm trying to pass in an URL as a string parameter to a WEB API GET method. The controller: public class LinksController : ApiController { public HttpResponseMessage Get(string targetUrl) { ...
0
votes
3answers
277 views

How to configure odata web api route for method that always returns single entity

I'd like to configure a route that always returns a single entity. The controller looks like: class StatsController: ODataController { public Stats Get() { return new Stats(); } } ...
1
vote
1answer
232 views

How to create ASP .NET MVC4 Web API to search my multiple parameters

How to create ASP.NET MVC4 json Web API which allows to search products by id, barcode, search term or retrieve all products since date ? I tried to use ASP.NET MVC4 controller below. Calling ...