Questions tagged [webapi2]

127 questions
0
votes
1 answer

Unable to generate Elmah.axd file of Elmah logging with Web API

I have created Web API only. In that I want to use Elmah Logging. I have installed Nuget package of it. But when I try to access Elmah.axd file from browser it gives me an error : 404 Not Found. And that file is not generated. I have followed this…
Ankita
  • 1,416
  • 4
  • 17
  • 42
0
votes
3 answers

WebApi2 default exception object for filter

Given an exception filter like this. public override void OnException(HttpActionExecutedContext context) { var resp = new HttpResponseMessage(HttpStatusCode.InternalServerError) { // what must I change here to…
Jim
  • 14,952
  • 15
  • 80
  • 167
0
votes
1 answer

Verify claims/roles in token with Web API 2 bearer token

I would like to confirm that the the claims in the bearer token are up to date on each API call so that I be sure that the given user still have access to the given method. For example, for a method decorated with [Authorize(Roles = "admin")] I…
tymtam
  • 31,798
  • 8
  • 86
  • 126
0
votes
2 answers

Web API 2 - Method now allowed(405) for PUT

I am stuck with Web API 2 controller, from which I call PUT method and it gives me an error that method isn't allowed. I added lines of code in Web.config that prevent WebDAV to block methods. I tried everything but it is not working. It is probably…
0
votes
1 answer

error writing mime multipart body part to output stream while uploading image files

I am following this link to upload files from mvc view to server using webapi2 http://www.strathweb.com/2012/08/a-guide-to-asynchronous-file-uploads-in-asp-net-web-api-rtm/ but I am getting this error every time "error writing mime multipart body…
Arshya
  • 660
  • 3
  • 12
  • 30
0
votes
0 answers

Webapi controller and Objectdatasource

I want to move step by step from webforms to a client application based on z angularjs or devextreme. At the moment I am using an objectdatasource and load data over a kind of controller that is marked as dataobject. Since I want to go step by…
Franki1986
  • 1,320
  • 1
  • 15
  • 40
0
votes
0 answers

Route to same controller with different route prefixes

I have an WebApi 2 application which has become popular with our customers and as a result we're aiming to make it as generic as possible so that subtle changes to the application will be available to all but I have a problem. My plan was to use the…
Ash Robinson
  • 41
  • 1
  • 1
  • 9
0
votes
1 answer

select2 remote data: populate using Web API 2 endpoint

As per the title I am using the latest select2 select box on a HTML5 page and using their example I am making a call to a Web API 2 endpoint I created. For testing purposes the endpoint simply builds a collection of Tags and returns the result as a…
Trevor
  • 1,561
  • 1
  • 20
  • 28
0
votes
3 answers

C# web API linq to SQL List object

I'm trying create a web API for an autocomplete textbox. I have the API working with sample data, but I don't know how to add data from my table. Here is my controller: namespace IMDSEbs.Controllers { public class CompanyController :…
ChrisPasa
  • 113
  • 5
  • 15
0
votes
1 answer

How to host a WebAPI2 console app in production?

I was reading this article in looking for differences between creating an API using WebAPI and MVC and came across this statement: In simple load testing on my local machine, I’ve found that Web API endpoints hosted in console apps are nearly 50%…
ElHaix
  • 12,846
  • 27
  • 115
  • 203
0
votes
1 answer

How to call a WebAPI2 from VB.NET

I'm trying to call a WebAPI2 api from a legacy VB code. The API works when called from fiddler or from the AngularJS client. [Route("CreateMyObject")] [HttpPost] public async Task> CreateMyObject([FromUri] int parentId,…
JBourne
  • 180
  • 2
  • 10
0
votes
2 answers

WebAPI2 : [DELETE] Method not allowed in CODE but in Fiddler it is working

I tested my WebAPI2 (DELETE) in Fiddler and it is working fine but in my code had an error of Method not Allowed. This is my Code : public async Task deleteUser(int id) { string URI = "http://api.danubeco.com/api/userapps"; …
Ryan Ayala
  • 77
  • 1
  • 8
0
votes
1 answer

Web Token Authenication - No MediaTypeFormatter available

Using Visual Studio 2013 I've create a new Web API 2 project and a new MVC project. There will be other clients accessing the API which is the reason it was created. Eventually the clients for the API will be allowing users to create login account…
user3140169
  • 221
  • 3
  • 12
0
votes
0 answers

Download excel file using jquery from web api2 controller

I have web api controller method to download excel file, by passing "FileName" as a parameter, can anybody help me how to download the file using $.Ajax or any other possible way. API Controller…
Rocky Royalson
  • 119
  • 2
  • 6
0
votes
0 answers

JSON.NET WebApi 2 Controller, deserialize all, serialize some

I have an class like this: [JsonObject(MemberSerialization.OptIn)] public class Event { [JsonProperty] public Guid EventID; public string Source; public UInt64? EventCode; public DateTime? TimeStamp; [JsonProperty] …
galmok
  • 869
  • 10
  • 21
1 2 3
8
9