FAQ Database Discussion Community
c#,web-api
I got the following code, and I can't get the action name to work or is something else wrong here? I want to create a custom search, where usually when you look for one object in an api you search for the id, but I would like to search for...
sql-server,iis,web-api
Hello Stack Overflow, So, I created a ASP REST API with WebAPI 2.2 in Visual Studio 2013. This API returns data from a database in the form of JSON object back to a client calling. Now, I deployed this API to an IIS Distribution on one of our servers running...
azure,web-api,windows-azure-storage
I have a web api which does a task and it currently takes couple of minutes based on the data. This can increases over time. I have Azure scheduler job which calls this web api every 10 minutes. I want to avoid the case where the second call after 10...
c#,model-view-controller,web-api,httpresponse,fileresult
I have a method in my API that returns a HttpResponseMessage: [HttpGet, HoodPeekAuthFilter] public HttpResponseMessage GlobalOverview() { try { StatsRepo _statsRepo = new StatsRepo(); string file = _statsRepo.IncidentData().AsCSVString(); if (file == null) { return Request.CreateResponse(HttpStatusCode.NoContent); } HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new StringContent(file); result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");...
c#,task-parallel-library,web-api,asp.net-web-api2
I've been seeing some conflicting information on the subject, and I would like to achieve some clarity here. Originally, you would have Web Api actions such as: Model Action(); HttpResponseMessage Action(); Then, with the addition of TPL enhancements to Web Api, you could have Task<Model> Action(); Task<HttpResponseMessage> Action(); And supposedly,...
javascript,jquery,web-api
I wanted to set error handling in my getJSON calls. This is my calling code: try { $.getJSON(uri) .done(function (data) { //do some thing with the result }).error(errorHandler()); } catch (err) { alert(err); } function errorHandler(page) { return function (jqXHR, textStatus, errorThrown) { console.log(page); // it works }; } and...
c#,asp.net-web-api,orchardcms,web-api
I am creating an Orchard module where i want to add a WebApi controller. My Module.txt: Name: ModuleName AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net Version: 1.0 OrchardVersion: 1.0 Description: Description for the module Features: ModuleName: Description: Description for feature ModuleName. I have added an ApiRoutes class: using Orchard.Mvc.Routes;...
mongodb,web-api
I have a database that created in MongoDB using Robomongo tool. How can I update these data in Web API by its default POST, PUT, DELETE methods in ValuesControllers.cs? Database name : StudentInfo Collection Name : Student { _id : ObjectId(), name : "lqbal", department : "CSE", phone : "0194949402"...
.net,web-api
While not entirely RESTful, I think it makes sense to use actions where you're doing something more conceptually involved than just manipulating simple data. Therefore I have adopted the following scheme: /api/projects/ = Returns all projects /api/projects/{id} = Returns single project /api/projects/{id}/{action} [POST] Applies action on a project, such as...
c#,mongodb,web-api
I am trying to connect MongoDB with Web API in Visual Studio 2013. All I want to do is create a simple database with C#. All of my code is in ValuesControllers.cs file. I created a simple Model class - public class Book { [BsonId] public int Id { get;...
c#,validation,rest,web-api,data-annotations
I have a Web API project... I would like to respect the REST principles, so I should have just a GET method and just a POST method... I have to do a search, so i think this matches the GET method, because after the search I obtain the result and...
asp.net-web-api,asp.net-mvc-routing,web-api,asp.net-web-api-helppages
I am getting repeat entries rendered in my Web API Help Page with different parents, such as these, that refer to the same method: GET api/{apiVersion}/v1/Products - Gets all products ... GET api/v1/Products - Gets all products ... I have a Web API page with some routing like this: config.Routes.MapHttpRoute...
angularjs,visual-studio,asp.net-mvc-4,routes,web-api
I have one solution in Visual Studio 2013 which contains MVC Web API and Angular app. I have set Multiple Startup Projects so both projects start in the same time when debugging. The both start OK, but they are running on different ports so there is no way for front-end...
asp.net-mvc,entity-framework,asp.net-mvc-5,web-api,asp.net-web-api2
I'm developing an ASP.Net MVC 5 application with Web API 2 and Entity Framework. I have created a WEB API 2 Controller with actions, using Entity Framework named EmployeeAPIController and consuming the API using ajax call as shown below. function loadEmployees() { alert("In Load"); $.ajax({ type: "GET", url: "/api/EmployeeAPI", success:...
c#,data-annotations,web-api,requiredfieldvalidator
I have the following custom required attribute: public class RequiredIfAttribute : RequiredAttribute { private string _DependentProperty; private object _TargetValue; public RequiredIfAttribute(string dependentProperty, object targetValue) { this._DependentProperty = dependentProperty; this._TargetValue = targetValue; } protected override ValidationResult IsValid(object value, ValidationContext validationContext) { var propertyTestedInfo = validationContext.ObjectType.GetProperty(this._DependentProperty); if (propertyTestedInfo == null) {...
asp.net-web-api,web-api,asp.net-web-api2
I found this example in google: public string GetValue([FromUri]Book b, [FromUri]Author a) { return b.Name + " ("+a.AuthorName+")"; } public string PostValue([FromBody]Person p) { return p.FirstName; } I can't understand what is the point of [FromUri] attribute if HTTP GET method send data only as part of the URl respectively,...
json,deserialization,web-api,circular-reference
I have a JSON string such as: { "$id": "1", "Username": "mrdan", "Email": "[email protected]", "Roles": [ { "$id": "2", "Name": "Super Admin", "Users": [ { "$ref": "1" } ], "Permissions": [ { "$id": "3", "Name": "UserSave", "Roles": [ { "$ref": "2" } ], "Id": "2d9a1268-6e53-4749-89f6-59ec0132e737" }, { "$id": "4", "Name":...
c#,asp.net,asp.net-web-api,web-api,asp.net-web-api2
I have two different model need to be passed to web api. those two sample model are as follow public class Authetication { public string appID { get; set; } } public class patientRequest { public string str1 { get; set; } } so to get work this i have...
asp.net-mvc,angularjs,web-api
I am attempting to use an asp web api to populate an html table using angular. everything works great if I debug in firefox (I'm assuming because my web service is being returned in json) however in ie and chrome it does not load (the web service returns xml in...
asp.net,asp.net-mvc,entity-framework,generics,web-api
Sorry all , my English isn't very well , so I will try to use code to tell everyone what I need.In format situations,I will create 2 controller when I have 2 models(ex: users/product) , as following var serializer = new JavaScriptSerializer(); var users= new users() { id = 1};...
asp.net-mvc,web-api,asp.net-web-api2,azure-active-directory,openid-connect
I'm trying to create a protected controller via Azure AD application roles. Here is an exempt from Startup.Auth, which is basically provided by Visual Studio template: public void ConfigureAuth(IAppBuilder app) { ApplicationDbContext db = new ApplicationDbContext(); app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseOpenIdConnectAuthentication( new OpenIdConnectAuthenticationOptions { ClientId = clientId, Authority = Authority,...
javascript,c#,web-api,nodatime
I'm about to go insane dealing with datetime issues and the web. I have a web server hosted in the Central Time Zone. When clients in the Eastern Time Zone try and schedule an item for a given day using my app, they pass in the value of (for example)...
c#,web-api,ionic,zipfile,pushstreamcontent
I am trying to make a zip file that contains pdfs. When i extract the zip, the pdfs are corrupted. I placed a watch on 'outputStream'. Here is the first exception 'outputStream.Length' threw an exception of type 'System.NotSupportedException' long here is the entire watch Code [HttpPost] [ActionName("ZipFileAction")] public HttpResponseMessage ZipFiles([FromBody]int[]...
iis,model-view-controller,signalr,web-api,signalr-hub
Please forgive me if this has already been asked before. I looked around, but my situation didn't come into play on any answered question I came across. I'm Using SignalR 2.2.0 Setup: I have a WebAPI 2 web application (call it API For short) that holds my hub called ChatHub....
c#,web-api,asp.net-web-api2,autofac,ioc-container
I have a custom DelegatingHandler in a class library that I need to register with Autofac. The webapi host resolves it's dependencies on runtime, so the host has no references to this library. public class LocalizationHandler : DelegatingHandler { protected override async Task<HttpResponseMessage> SendAsync( HttpRequestMessage request, CancellationToken cancellationToken ) {}...
asp.net,web-api
I trying to send parameters by GET request to my web api method like this: somesite.com/api/somesection/v1/someaction?val1=1&val2=2 headers: Content-Type: application/json; charset=utf-8 And my api method is: [HttpGet] [Route("api/somesection/v1/someaction")] public void someaction(ModelParams p) { //do some action } And "ModelParams" is: public class ModelParams { [Required] public string val1{ get; set; }...
c#,asp.net,azure,web-api,windows-azure-storage
I am working on an application where file-uploads happen often, and can be pretty big in size. Those files are being uploaded to Web API, which will then get the stream from the request, and pass it on to my storage service, that then uploads it to Azure Blob Storage....
c#,.net,rest,session,web-api
I am building a RESTful web api. Once a user is authenticated and authorized, they are given an access token which contains: user_id timestamp permissions My question is if it is better to encrypt those tokens using a symmetric algorithm and pass it to the client OR just pass a...
c#,asp.net,visual-studio-2013,web-api,publish
So I made myself a C#-WebApi REST Service. When I build/run my application in Visual Studio everything works perfectly. But everytime I try to publish my project as a filesystem, two errors appear in the error list. The strange thing here is that these errors disappear after a few seconds...
odata,web-api,expand
I have an ODataController with a Get method as such: public IHttpActionResult Get(ODataQueryOptions<MyModel> queryOptions) { IQueryable<MyModel> models = _Models.AsQueryable(); // _Models Defined in Controller as List<MyModel> and is already populated with nested data for both .LevelOne and .LevelOne.LevelTwo which are two other Lists. Uri fullrequest = Request.GetRequestContext().Url.Request.RequestUri; // http://localhost:8080/odata/Root?$expand=LevelOne($expand=LevelTwo) Uri...
c#,json,web-api,serializable
I have the following scenario: I am using WebAPI and returning JSON results to the consumer based on a model. I now have the additional requirement to serialize the models to base64 to be able to persist them in cache and/or use them for auditing purposes. Problem is that when...
asp.net,web-api,data-caching
I need to remove ASP.Net cache from inside a Web API method. This cache by the name of 'ContentNames' was set in the code-behind of an aspx page using following code. Is this possible, and if yes, then how would I access ASP.Net data cache from inside the Web API...
c#,asp.net,visual-studio-2013,odata,web-api
I am trying to create an odata endpoint for a table valued function in a database. I am sure with the code, however upon running the application i get the error Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to...
c#,post,httpclient,web-api
I'm trying to make an application for Windows which acts like a server for a mobile application (PhoneGap). This application is like a remote for the server application, it invokes methods in which their turn do things. After long searching and trying to see which components can work together I...
c#,ajax,entity-framework,web-api
I am working on a website that allows clients to enter tabular information (merchants) into a grid. Each record can be identified by a unique id. I am trying to enable bulk updates through my Web API controller, instead of individual PUT requests. These requests are made through AJAX on...
c#,web-api,asp.net-web-api2
I’m writing a custom WebApi Authorization filter. I need to read the securitySqlConnectionString back from the actionContext variable. To do this, I need to perform a cast (e.g. as I have attempted using TransactionRequestBundle<SearchDefault>), however, the problem is that in TransactionRequestBundle<T>, T will vary, hence the cast below will only...
web-api,umbraco7
I read a lot on this issue. I read that I can use at web api asp.net to create rest service in Umbraco. Can I create this api in Umbraco back office? If not, how do I connect the service to my local Umbraco site? I can't find a simple...
asp.net,asp.net-mvc,web-api
I'm trying to make my ASP.Net 5 MVC 6 WebAPI project output a file, in response to a HttpGET request. The file is from an Azure Files share, but it could be any stream containing a binary file. It seems to me that MVC serializes the response object, and returns...
rest,design,web-api
Using the example of facebook users having a collection of photos, if I'm designing a RESTful API for the photos, these will have GET/POST/PUT/DELETE endpoints for the photos themselves, is it breaking REST or a design patterns to have a get by user id? e.g. GET Photos/ //gets all photos...
knockout.js,asp.net-mvc-5,web-api
The solution was the same as in this question: How to get an observableArray's length? ...but the question itself is unique so anyone in the same situation will hopefully have an easier time finding the answer than I did. I'm fairly new to Knockout and to Web API. I've built...
c#,asp.net,angularjs,web-api
We have an angular page that accesses a restful web service we are also generating. For the website we are making the routes match those of the web service for simplicity. For example accessing the website at http://myserver.com/books/book/1/chapter/2 would access the same route in the web service. Now the slightly...
javascript,c#,web-api,put
I'm trying to call my C# Web API from javascript, and the data doesn't appear to be passing correctly. The GET method I have works perfectly fine, but I can't seem to get the PUT working as I intend. Here's the structure: Javascript: $.ajax({ type: "PUT", url: "/api/FTP", data: "Hello...
c#,multithreading,web-api
I have web api 2.1 service. Here is my Action : public IHttpActionResult Get() { // Desired functionality : // make e.g 5 request to `CheckSomething` with different parameter asynchronously/parallel and if any of them returns status Ok end request and return its result as result of `Get` action; }...
iframe,odata,web-api,content-type
I have a Web API 2.2 controller that is under conversion to use OData v4. In the ApiController I am able to do this: HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, MyObject); response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return ResponseMessage(response); Which sends back a Http Status Code of 201 - Created, with an object serialized...
c#,iis,.net-4.5,web-api
Probably this question has already been made, but I never found a definitive answer. Let's say that I have a Web API 2.0 Application hosted on IIS. I think I understand that best practice (to prevent deadlocks on client) is always use async methods from the GUI event to the...
asp.net-mvc,asp.net-web-api,web-api
FYI, I have no custom routing, no usage of MapHttpRoute. My Web API controller is as follows: [RoutePrefix("api/stat")] public class StatController : ApiController In that controller I has these methods: [Route("{statType}")] public StatState GetCurrentStat(string statType, UserInfo userInfo) [Route("getAllAccount")] public Dictionary<string, StatState> GetAllAccountCurrentStat(UserInfo userInfo) [Route("getScoreHistory")] public StatHistory GetStatAccountScoreHistory(string statType, UserInfo userInfo)...
c#,database,linq,web-api
I've got a table containing a list of persons, where 5 persons are between the age 12 to 25. Those persons are living in Limburg and are male. string[] leeftijdstring = new string[2]; int leeftijd1; int leeftijd2; int getal = 0; if (leeftijd == "null") { leeftijd1 = 0; leeftijd2...
c#,post,webclient,web-api
I need to pass below object as a parameter for a post method using web client method in C#. { "company": { "id": "e63dfcab345260b2591f585126ede56627db4ef2" }, "requestor": { "id": "", "email": "[email protected] ", "firstName": "Test", "lastName": "Requestor", "role": "employerAdmin", "phone": "(415)1112222", "title": "HR Manager" } } I converted like this...
c#,asp.net,authentication,web-api,asp.net-5
I've been studying ASP.NET 5 for some time now and there is something I'm yet confused. To implement authentication in Web API 2 what I used to do was basically use the OWIN OAuth Authentication Server Middleware. It was simple to use, I could configure just what I needed and...
asp.net-web-api,web-api,servicecontract,webchannelfactory,odatacontroller
I have implemented OdataController(s) for my Web-API. Is it possible to use a ChannelFactory (or WebChannelFactory) to communicate with the Web-API, specifically i would like to call custom Functions and/or Actions. Of course, the OdataController i have created does implement a ServiceContract. But i am not sure if this is...
c#,asp.net-mvc,asp.net-web-api,console-application,web-api
I've written the following code in Console. I want to display the string the code returns, on my Layout.cshtml page like any other things on the page. How can I do it using Web API? namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string serverName = "localhost";...
entity-framework,asp.net-web-api,async-await,web-api,asp.net-web-api2
I am using web api 2, and entity framework 6. I have created an async web api, which updates all the records at once. I am also using Autofac for dependency injection. My service interface is as follows : Task<Approval> TakeAction(int id, bool isApprove) void TakeAction(bool isApprove) These are my...
c#,asp.net-web-api,web-api
I have tried the following : [HttpPost] [ActionName("print")] public string Print([FromBody] string _print_request) { return _print_request; } and the result was always null , so I tried to use an object [HttpPost] [ActionName("print")] public print_request Print(print_request _print_request) { return _print_request; } the result still null the print_request object is as...
c#,web-api,owin
I've got a small problem regarding a server hosted with OWIN. I'm trying to make it accessible to the local network which means I have to add a few extra options: // Start OWIN host StartOptions options = new StartOptions(); options.Urls.Add("http://localhost:4004"); //options.Urls.Add("http://127.0.0.1:4004"); //options.Urls.Add(string.Format("http://{0}:4004", Environment.MachineName)); using (WebApp.Start<Startup>(options)) { // Create HttpCient...
c#,asp.net,.net,asp.net-web-api,web-api
I'm trying to build a small application, a api to get data with entity framework and pas out to json with web api but get the error: {"Message":"No HTTP resource was found that matches the request URI 'http://localhost:61267/api/GetCarousel'.","MessageDetail":"No type was found that matches the controller named 'GetCarousel'."} Call link: http://localhost:61267/api/GetCarousel...
asp.net-web-api,asp.net-mvc-5,asp.net-mvc-routing,web-api,asp.net-web-api-routing
I have an Api controller with two different actions that take different parameter types. // GET: users/sample%40email.com [Route("users/{emailAddress}")] public IHttpActionResult GetUser(string emailAddress) // GET: users/1D8F6B90-9BD9-4CDD-BABB-372242AD9960 [Route("users/{reference}")] public IHttpActionResult GetUserByReference(Guid reference) Problem is multiple actions are found matching when I make a request to either. Looking at other answers I thought...
rest,http-headers,web-api
Like the Last-Modified HTTP header field for updated at, is there a special one for created at? Thanks....
asp.net-mvc,post,asp.net-web-api,web-api,fiddler
I am new in ASP.NET MVC web api. I am trying to run default web api project created by visual studio 2013. Also, I am using fiddler to test web api. In that default project a post method is created 'api/Account/Register'. When I try to run this in fiddler UnsupportedMediaTypeException...
regex,node.js,mongodb,express,web-api
Okay so I'm trying to create a simple todo list, web api. I have the basic functions implemented and working properly but I'm trying to use a query to search by task_name as declared in my code, but no matter what I can't seem to get it functioning. app.js var...
android,json,xamarin,web-api
I am creating cross platform application using xamarin forms which display some data like following into the list view. if user change their own language to Hindi,Spanish or Turkish then this list should be display into the Hindi, Spanish or Turkish {"employees":[ {"firstName":"John", "lastName":"Doe"}, {"firstName":"Anna", "lastName":"Smith"}, {"firstName":"Peter", "lastName":"Jones"} ]} how...
odata,web-api
Is there anyway wherein i can get only count of the data in response payload without any value array. I am using ODataV4.0 with Webapi 2.2. Currently it returns all the values and count when i query something like: http://odata/People?$count=true I just need something like "@odata.count":1, "value":[] or without "value"....
c#,web-api
i have a web api with 3 controllers, every one has a 15 Get/Post Commands. Which means,, that if i do something like that : if (!AuthorizedChecker.IsAuthorized(Request)) return null; when - IsAutohrized is to check if he can acess the web api, but do i really need to put that...
apache,visual-studio,cordova,web-api,visual-studio-cordova
I m new to apache cordova project in visual studio, i have doubt that how system can save data in my sql server from this project. I have already created web API to save data to sql server. How can I call that from apache cordova visual studio project. Any...
c#,web-api
I have created POST/GET request in MVC before. In my HomeController [HttpPost] public string Index(int Value) { return Value.ToString(); } And setting chrome extension POSTMAN with a form-data I can call http://localhost/mvcApp/ with a variable 'Value' with value '1' and get a string '1' in return But when I create...
php,asp.net,web-api
Please help me to tell me how to use the PHP to call asp.net web api ,thanks. sorry I didn't use PHP before , so I just want to use very simple code to call server side of the web api . thanks again
authentication,asp.net-web-api,web-api
I am about to create my first restfull web service where i chose MVC WEB API to be the "provider". After reading about authentication i am a little confused. My requirements is that on call to any url of webservice i want client to be authenticated, except sign in url....
asp.net-mvc,rest,asp.net-web-api,web-api
I am trying send both parameter get and post to method on service without model but it's always null. How can i solve this problem? Also what is logical reason of this problem? Codes as follow which i encountered problem; [HttpGet] public Result GetUser(string userId) { using (DataContext dc =...
c#,asp.net,json,web-api
I have a web api I communicate with. When exception occurs, I get the following JSON template: { "Message": "An error has occurred.", "ExceptionMessage": "Index was outside the bounds of the array.", "ExceptionType": "System.IndexOutOfRangeException", "StackTrace": " at WebApiTest.TestController.Post(Uri uri) in c:\\Temp\\WebApiTest\\WebApiTest\\TestController.cs:line 18\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClassf.<GetExecutor>b__9(Object instance, Object[]...
javascript,dom,web-api
Is it possible to bind functions to events on child windows? document.getElementById('foo').onclick = function() { var newWindow= window.open('other.html', "_blank"); newWindow.document.addEventListener("onreadystatechange", function(){ console.log('foo'); // This is never run. Can I construct the new window so that it is run "onreadystatechange"? }); return false; }; Note that I would like to bind...
json,model-view-controller,asp.net-web-api,web-api
I want to send JSON from desktop application to the server with mvc wepApi. this is my desktop application code ,that convert data to the JSON and send it. private void btnAddUserType_Click(object sender, EventArgs e) { UserType userType = new UserType(); userType.UserTypeName = txtUserTypeName.Text; string json = JsonConvert.SerializeObject(userType); HttpWebRequest httpWebRequest...
asp.net-web-api,web-api,ioc-container,structuremap
When my WebAPI controller is called from a client, I run into the following errors: ServiceLocatorImplBase.cs not found error An exception of type 'Microsoft.Practices.ServiceLocation.ActivationException' occurred in Microsoft.Practices.ServiceLocation.dll but was not handled in user code The WebAPI controllers use constructor injection to inject a repository dependency which should be resolved by...
c#,ninject,web-api,nancy,onion-architecture
I have a requirement to create a Sync method. 1) On input it takes SyncRequest object. class SyncRequest{ public List<SyncObj> Objects{get;set;} } class SyncObj{ public Type Type{get;set;} public object Object{get;set;} } 2) Based on type of each object i need to use different service to proceed and the different repository...
web-api,azure-active-directory,openid-connect
I'm having trouble with 401 responses that cause a redirect (302) to the login page. My application uses both MVC and Web API. I'm using OpenID and Azure Active Directory to authenticate users, my auth setup is as follows: private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"]; private static string appKey =...
jquery,asp.net-mvc-4,web-api
I am using data annotation to validate any model that I plan to add and returning validation messages back to my view if rules are broken, here's the method: // POST api/Issues public HttpResponseMessage PostIssues(Issues issues) { HttpResponseMessage response; if (ModelState.IsValid) { //db.Issues.Add(issues); //db.SaveChanges(); bool isValid = _unitOfWork.IssuesRepository.Insert(issues); if (!isValid)...
entity-framework,odata,web-api,asp.net-web-api2
I have got two models. A Product model: public class Product { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public virtual ICollection<Categories> Categories { get; set; } } And a Categories model: public class Categories {...
dependency-injection,web-api,autofac,owin
I have an WebApi application using OWIN and Autofac. Although controllers and parameters get resolved correctly, I would like to be able to use OwinContext.Get<type> to resolve types registered with Autofac. Is that posible? Already setapp.UseAutofacMiddleware(container); and config.DependencyResolver = new AutofacWebApiDependencyResolver(container); By example, I registered builder.Register<IAppConfiguration>(c => new AppConfig()); and...
web-api,owin,katana,http-status-code-405
I am creating an Owin self-host Web API and getting a 405 method not allowed response when posting a DELETE request the server. POST and GET seem to work with not problems. I can reproduce the error in the ASP.Net Sample application OwinSelfHostSample project at https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/OwinSelfhostSample/ReadMe.txt I do not have...
c#,asp.net,castle-windsor,web-api,owin
I have a Web Api with owin and Windsor. Get next error: An error has occurred.An error occurred when trying to create a controller of type 'DBManagerController'. Make sure that the controller has a parameterless public constructor.System.InvalidOperationException at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request) at...
dependency-injection,unity,web-api
I am registering a load of dependencies like so. container.RegisterTypes(AllClasses.FromLoadedAssemblies(), WithMappings.FromMatchingInterface, WithName.Default, overwriteExistingMappings: true); This registers things fine and the web api endpoints are properly configured. If I do iisreset or simply wait for a bit then things fail with The error message is not terribly helpful "exceptionMessage": "An error...
php,post,web,web-api
Well, I know that the headline look simple, but i was looking from 3 days for an example on how to make the POST request to webapi. Currently I am using JQuery to do my POST, but I need some php script to run and talk to my C# webAPI,...
c#,authentication,authorization,web-api,asp.net-5
I'm working with ASP.NET 5 (vNext) application. I'm trying to implement Token Based Authentication but can not figure out how to use new Security System. My scenario: A client requests a token. My server should authorize the user and return access_token which will be used by the client in following...
web-api,asp.net-web-api2,azure-documentdb
I am using Azure Document DB and can successfully create an object using the code below. However I am not able to return the created object back to the client. Despite the code hitting the line return Ok(doc); the response seen in both Fiddler and Postman is always empty. Controller...
json,angularjs,web-api
I am trying to create a quick application to try to learn AngularJS with Web API (I have worked with ASP.NET MVC but not had chance to use Web API) server-side, but I cannot seem to get my object to serialize when posting the the Web API method. My object...
api,rest,oauth-2.0,web-api,api-design
TL;DR; Is there any way to bind a (Bearer?) token to a unique client, and represent that in the HTTP REQ Headers? In the scenario that a user has an account to a service. The same user should be able to consume the services using different client applications (different Browsers,...
c#,web-api,owin
Got some problems with my OWIN selfhost server. I'm trying to make it accessible through my local network. Which means the IP address of the host will be used to connect to the server. Bad thing is, I get a bad request, invalid hostname. I've done some Googling and I...
c#,wpf,asp.net-web-api,async-await,web-api
I changed App.OnStartup to be async so that I can call an async method on a web api, but now my app does not show its window. What am I doing wrong here: protected override async void OnStartup(StartupEventArgs e) { base.OnStartup(e); HttpResponseMessage response = await TestWebAPI(); if (!response.IsSuccessStatusCode) { MessageBox.Show("The...
asp.net,asp.net-web-api,web-api
Please provide me regular expression to validate email id like below in web api method: // GET: users/sample%40email.com [Route("users/{emailAddress:regex()}")] public IHttpActionResult GetUser(string emailAddress) Here i need regular expression which will validate email like sample%40email.com and will work in :regex() of web api route attribute....
c#,dependency-injection,ninject,web-api
I'm trying to create an instance of an object from a web.config configuration, like this: <add name="Log4Net" type="Spm.Services.Logging.Log4NetServices.Log4NetReporting, Spm.Services" /> The type Log4NetReporting has a constructor with an argument I want to inject, like this: public class NLogReporting : ILogReporting { [Inject] public NLogReporting(IRepository<NLogError> nLogRepository) { this.nLogRepository = nLogRepository; }...
rest,web-api,asp.net-web-api2,dotnet-httpclient
Im trying to send a PUT to my Web API and am struggling a bit as to how I should construct the actual Http request. Below is an integration test sample. It works fine using HttpMessageInvoker to call the Web API Put, but I want to use HttpClient in test...
asp.net,asynchronous,web-api
I have an asp.net MVC website which is consuming a rest api to receive it's data. I'm using asynchronous tasks to perform the requests as there can be many on each page. After a while of uptime the website has been throwing the following error when trying to receive data....
json,angularjs,asp.net-web-api,web-api
I get some data from a WebApi, the answer (below the code to get the datas) is in JSON. But I can't access this result from angularJS. The datas look like : { "$id": "1", "result": [ { "$id": "2", "name": "Français", "code": "FR", "id": 1 }, { "$id": "3",...
c#,angularjs,rest,web-api
I'm fairly new to c# and i'm completely stumped as to what I should be doing next to be processing inputs from a user inside of an input form I've created with Bootstrap and Html along with a angular js controller. every time I try to return values with my...
php,web-api
I'm trying to access webservice using php. I'm calling a method from the services then i get an error . My code is below,help me sort this.. $message = $_REQUEST['message']; $recipient ="250788353869";//$_REQUEST['recipient']; $phone=(int)$recipient; $account=""; $pin=""; ini_set("soap.wsdl_cache_enabled", "0"); // Set to zero to avoid caching WSDL $soapClient = new SoapClient('http://gateway.esicia.com?wsdl'); $result...
c#,.net,azure,web-api,azure-mobile-services
Firstly, I had this problem where the value of RequestStatus is unable to passed from client to Mobile Service during InsertAsync, which will be processed in null (client - mobile app) (server - Azure .NET Backend Mobile Service) Secondly, I had also tried to change its value in the debugger...
asp.net,xml,vb.net,asp.net-web-api,web-api
I have a problem with an XML response to a call to the Web API. Specifically, I have a function "GetValue" call that when I should return in XML format based to the id or class "Cellulare" or class "Televisore". The problem is that if I make a request from...
security,encryption,server,web-api,httpresponse
I am new in network security area, now I am designing a REST web api. The question is that could http response and request be eavesdropped? If it is impossible, then I don't need encrypt the response json file and the request parameter....
c#,asp.net,.net,database,web-api
I've got two lists of data from two different databases that both share a common column. I want iterate through both lists and if the common value in ListA is found while iterating through ListB I want to add two new columns to that same row on ListA. Once it...
c#,.net,iis,asp.net-web-api,web-api
Scenario I've a Web Api 2.2 RESTful service made with VS2012 C# I'm using Basic authentication with a custom check user/pass (works fine) Some methods has [AllowAnonymous] attribute Several methods are using [Authorize(Roles = "myRol")] In local works as well (read the user and pass, check it with the database,...
jquery,json,asp.net-web-api,web-api,jquery-easyui
I am using JQuery EasyUI's datagrid is a very basic implementation. Following on from my previous SO post (where I managed to get JQuery EasyUI's datagrid to load in data from my webservice using the JavaScript approach). I now have a very bizarre issue that I cannot understand. In short,...
c#,.net,multithreading,task-parallel-library,web-api
I have a web api coded in c#. The web api uses functionality which is shared with other in-house components. it depends on single threaded flows and uses thread local storage to store objects, and session information. Please don't say if it's good or bad, that's what I have to...