Questions tagged [webapi2]

127 questions
1
vote
1 answer

Web API 2 - stream reading a file

How do you read just part of a file as a stream in web api and do actions on this stream without taking the whole file in memory? NB: I don't want to save the file anywhere before reading - it's uploaded to a web api controller. But what I really…
Fred Johnson
  • 2,539
  • 3
  • 26
  • 52
1
vote
1 answer

Not able to install Nuget Package " Microsoft.AspNet.Odata" in Web API, ASP.Net 4.5

I am new with Web API 2. I am trying to create an application using VS 2013 Update 4, ASP.Net 4.5, while trying to install "Microsoft.AspNet.Odata" Nuget Package,l getting following error: Attempting to resolve dependency…
1
vote
1 answer

Async HTTP Request in Web Api

I have googled for this and have managed to find several links explaining the concept of Async HTTP Requests in C# and Web Api 2. However I failed to get any working examples of the same. Just to clear the air, my requirement is as below. When the…
1
vote
1 answer

Change or overwrite response badrequest message web api c#

How are you, people I need to change the response message of the return of BadRequest(). When I use the request like this, BadResquest("error: you can not pass these values") I want to my api return something like this: {"error: you can not pass…
ernesto petit
  • 1,436
  • 1
  • 14
  • 19
1
vote
3 answers

WEB API2 / HTTP DELETE is not triggering - 405 error

Hi i am trying to delete the record (HttpDelete).the method in the controller is not triggering and getting 405 Method Not Allowed error. jquery below function deleteContract(contractId) { var contract = new Object(); …
Devanathan.S
  • 1,362
  • 1
  • 14
  • 22
1
vote
1 answer

Bluesnap api implementation using webapi2 and jquery

I am always getting authentication required window. when I call blue snap sandbox URL. I have googled and read some article which says because of CORS the Authentication required message box is appearing. I tried adding the basic authentication in…
Devanathan.S
  • 1,362
  • 1
  • 14
  • 22
1
vote
0 answers

web api 2 owin bearer token JwtFormat , how to return the same token for several logins (OAuthAuthorizationServerProvider and external)

I have an authentication server that return a token for several platforms (mobile,web etc), then with this token they can do requests to my API . Something like this :…
Gal Koren
  • 73
  • 1
  • 10
1
vote
1 answer

C# Odata WebApi List of Elements in Post

i could realy need some help. Im coding a small WebApi Program. While Unit testing i noticed i cant send a list of Elements to my post Method. First take a look at my Unit Test: [TestMethod] public async Task…
Andre Fritzsche
  • 126
  • 2
  • 11
1
vote
0 answers

How to implement mixed mode authentication using Asp.Net Web API2 and AngularJs application?

I've a requirement of using mixed mode authentication in my projects which uses WEB API2 (Service) and AngularJs (UI) as technology stack. I've found a no of articles exploring mixed mode authentication but all were using web application. Can we…
1
vote
2 answers

How to generate documentation using swashbuckle for WebApi 2 with Owin

I have created a WebApi Project using this article. Things are working fine. But now my client want to view the documentation using Swagger. I tried to do configuration but things are not working. not getting the list of controllers and their…
Ramesh Prasad
  • 60
  • 1
  • 2
  • 8
0
votes
1 answer

webAPi2 Invalid cast converting JSON to structure

I am getting this error trying to call a web2.0 api call. Message : "Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'NG_API_DNET_FRX.Models.mproject'." Here is the JSON that is being sent in from the webpage. The website…
greg
  • 1,673
  • 1
  • 17
  • 30
0
votes
2 answers

Autofac inject different services based on HTTP request

I've seen a lot a posts about implementing services with the same interface but I can't get a grasp on How to configure AutoFac to inject the service a want based on the Route called. Let's say I have 4 services that all implement the same…
Luke
  • 1
  • 1
0
votes
1 answer

Problem on CORS configuration with Web Api 2, OWIN and Identity Server

I have a few web applications under the same domain, all using a stand alone Identity Server 3 app for login purposes. Under test environment, every single one of then are under the same domain (http://192.168.100.1, or by dns…
Guilherme
  • 393
  • 1
  • 6
  • 15
0
votes
0 answers

ASP.NET Web API 2 - User Email Confirmation while registration

I want to implement email / account confirmation via email while user registration. But have difficulties with the following method, creation correct callbackUrl and a way how it should confirmed by application. Is there a best way to solve that? I…
bisecom
  • 1
  • 1
0
votes
1 answer

How to skip global actionfilter from specific methos

I have registered my actionfilter globally public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new MyNewCustomActionFilter()); } now i need to skip this filter in some methods, the behavior i want is like…
danilonet
  • 1,757
  • 16
  • 33
1 2 3
8 9