Returning the wrong type - cast?

In a Web API 2 project, i am trying to get all the coordinates belonging to a single item (can be anywhere from 1 to 1000s) and calculating the centerpoint. The function to calculate the centerpoint, works, as expected. But the below controller fail...
more »

2017-11-11 07:11 (1) Answers

TypeLoadException on Attribute in shared assembly

UPDATE 10:29 MST on 11/7 Oddly enough if I move the attribute out of the ComponentModel folder back into the root of the Common project the code works fine. I can't imagine what's possibly referencing the old namespace after all of the references we...
more »

2017-11-06 03:11 (3) Answers

asp.net ajax not sending data

My AJAX is not sending data to my http post controller. My controller: [Route("api/sendingData")] public class TestController : ApiController { [HttpPost] public string Post([FromBody] int propertyID) { return string.Format("Tes...
more »

2017-10-31 21:10 (1) Answers

Web API2 NinjectWebCommon.cs do not appear

I am doing an Empty Web API in Visual Studio 2013 Framework 4.5. Obviously NinjectWebCommon.cs do not appear. I installed via Nuget, Ninject, Ninject.Web.Common, Ninject.MVC5, Ninject.Web.Common.WebHost, Ninject.Web.WebApi, Ninject.web.W...
more »

2017-10-29 15:10 (1) Answers

Prevent accidental deletion on API call

I have a web method to delete a Furniture or one of his Properties: [Authorize] [Route("api/furniture/{furnitureId}/{property?}")] public HttpResponseMessage Delete(string furnitureId, string property = null) { try { if (property != ...
more »

2017-10-26 17:10 (1) Answers

How Authorization Token Works?

I am trying to understand how the Token system works between Web api and Angular JS for the authentication purpose. Please correct me if I am wrong. The token is stored in a database table and add the token manually on our client application to accom...
more »

2017-10-24 06:10 (3) Answers

AngularJS httpInterceptor set Date Header Value

Below code is my $http Interceptor Factory. In this code, I have set date header value to current date at config.headers.Date but it is showing null in Asp.Net WebApi Request Header Class. How can I set Date Header value to get Local DateTime value f...
more »

2017-10-22 21:10 (0) Answers

Angular post and web api C#

I've tried to make a contact page using AngularJS and C# controller using Web Api. I am working on it all the last week without find the correct answer that suits me. I tried also post thru AJAX, JQUERY and angular. Controller code: [HttpPost...
more »

2017-10-17 15:10 (2) Answers

Enable HTTP compression with ASP.NET Web API

We serve files for a website from our Asp .NET Web API: public class Startup { public void Configuration(IAppBuilder app) { var clientHostname = System.Configuration.ConfigurationManager.AppSettings["ClientHostname"]; var st...
more »

2017-10-13 23:10 (2) Answers

Odata with Asp.net and angularjs

I am following up in the course AngularJS Front to Back with Web API using ASP.net, we are trying to do queries using ODATA so i added this code in the ProductController in the WebAPI // GET: api/Products [EnableQuery()] public IQueryable<Product...
more »

2017-10-11 22:10 (1) Answers

JSON data not being saved in WebAPI

I'm following a Pluralsight course on AngularJS and WebAPI together. I'm trying to save data being sent from the client to the server using PUT, but the data is not saving and I'm not getting any errors. Also, It doesn't event hit the correct server ...
more »

2017-09-26 21:09 (2) Answers

angularjs Pass data has list data

I want to pass data what has list of child like here { id : 1, title : 'test', childs : [ { id : 1, name: 'name1' }, { id : 2, name: 'name2' }, { id : 3, name: 'name3' }] } I want it pass to web api controller public IHttpActionRes...
more »

2017-09-12 09:09 (2) Answers

Post HttpPostedFileBase To Remote Web API

I'm trying to post HttpPostedFileBase to remote webApi. public bool CreateClaimAttachmentCustomerDoc(ClaimAttachmentSimple attachment, HttpPostedFileBase hpf) { string jsonStrAttchment = JsonConvert.SerializeObject(attachment); ...
more »

2017-09-09 07:09 (0) Answers