Most voted "asp.net-web-api" questions
ASP.NET Web API is a framework for building HTTP services for clients such as browsers and mobile devices. It is based on Microsoft. NET Framework and ideal choice for Restful services.
Learn more…455 questions
Sort by count of
-
2
votes1
answer1098
viewsHow to configure Web Api route to accept named parameter(query string)?
I have a web api with the following method: [HttpGet] [Route("api/documento/doc/list?{cpf}")] public string Listar(string cpf) { return "value"; } I need the above method to be called through the…
-
2
votes0
answers15
viewsWindows Phone does not request an API
Well, I have the following modules in my project: Concerts.Console Concerts.Mobile Concerts.Core Concerts.Models Concerts.Webclient Concerts Tests. Basically it’s the following: The module…
-
2
votes1
answer3982
viewsHow to send complex object to Web API?
I need to pass a parameter to my Controller in the Web API which is a complex object, this object has some normal properties (the most complex is a Datetime). I’m doing it this way, but I can’t…
-
2
votes1
answer106
viewsEnsure that Httpconfiguration.Ensureinitialized()
Goodnight! I’m studying about ASP.NET (I come from java) and I’m a little confused by all this. I am trying to create an endpoint to return the client list of my database, however, I can not in any…
-
2
votes2
answers594
viewserror GET method while consuming Webapi
I created a project in Aspnet Webapi, added a ADO(Database-first) to connect to the Mysql database and created the controller using the option 'Controller with read/write actions and views, using…
-
2
votes0
answers493
viewsHow to schedule tasks for a given time C#
I need method to perform tasks every day at the same time which class should I use for this type of task?
-
2
votes1
answer45
viewsAPP database
Dear friends, in a mobile solution type an application that manages lava jet where users create their account and automatically can already manage their customers, cash flow, scheduling and etc...…
-
2
votes2
answers115
viewsChange in json File Format
My file is coming in this format, but I would like it not to appear this #id information before sale: { "$id": "1", //como não mostra isso? "venda": [ { "$id": "2", "poule": 73, "idusuario": 4,…
-
2
votes1
answer144
viewsShare Web API access token in different domains
Hello. I’m having a hard time sharing an access token (bearer) with different domains. This happens because I have to make a login page outside the domain of the site that consumes the REST API.…
-
2
votes1
answer112
viewsI made a sum with lambda and is not working as expected
I need to make a general sum for total and profit. If I made a sale with 4 items, I’m seeing in my grid four sum and that’s not it, even if it repeated 4 times, but it should be just a sum. I need…
-
2
votes2
answers352
viewsHow to receive the view model in a GET request Webapi?
Okay, I have a problem with my API here, and I’d like to ask for your help. I have here a form in Knockout JS, I serialize a constructor that in turn returns me a querystring so API?…
-
2
votes2
answers682
viewsAPI User and password in Header
I made an API and would like to know if it is relatively safe to put a username and password the way I did…
-
2
votes1
answer1139
viewsWeb API - Token
A MVC application accesses WEB API services. To access the WEB API it is necessary to inform a "token". In the WEB API application there is a button that generates the token. How to make the WEB API…
-
2
votes1
answer4221
viewsAsp.net web api From Ri and From Body when to use?
Asp.net web api that serves [Frombody] and [Fromuri] and when there is real need to use ? example: public IHttpActionResult Get([FromUri] email) { } public IHttpActionResult Get([FromBody] email) {…
-
2
votes1
answer1099
viewsRestrict access to the Web API
I have a Web API where I restrict access to your methods through the EnableCors, indicating the URL I want to give permission, as follows: namespace WebService.Controllers { [EnableCors(origins:…
-
2
votes1
answer393
viewsMOIP consumes Json Web Api MVC
I need to use the Moip Payments API as a payment method for my system, how do I request via json? Documentation Consultar cliente GET Por meio desta API é possível consultar as informações e…
-
2
votes2
answers1450
viewsC#url shortener
I’m adjusting a code in c# for a url shortener api to send in the sms inside an application, it’s all working, but the out-of-code api works, but within the code the Return comes back nothing, I’m…
-
2
votes2
answers240
viewsCustom Return in WEB API
Good afternoon. I would like to know if there is any standard or good practice (independent of the programming language), for building Web API that allow customization of the content of the…
-
2
votes2
answers441
viewsSystem.Data.Sqlclient.Sqlexception: Conversion failed when Converting the varchar value to int
I’m getting this Exception in c# when I try to read SQL data. I’m wondering if this error is a problem with my SQL or C#. My SQL code that makes the conversion is this: `$ (SELECT ORDEM FROM TABELA…
-
2
votes1
answer82
viewsToken Provider Asp.Net Webapi
in the company we work we do authentication and authorization via Bearer Token in an Asp.net webapi app, but I keep some information about user permissions with Claims... and this makes Token look…
-
2
votes1
answer255
viewsAsp.Net Razor with Json
I have a question and I have researched several sites but I did not get the answer. I develop systems in .Net with C# in MVC standard and use the on-screen presentation in the traditional View with…
-
2
votes1
answer1152
viewsSending complex objects via Httpget
I have a search method in my Webapi, as it is a search, I used [HttpGet], as a parameter of this method, I pass an object with the filter options I want, for example: public class ParametrosBusca {…
-
2
votes2
answers429
viewsHow to popular an object with the return of a Webapi query?
How popular the variable _clientes guy Cliente with the return of a consultation to a WebApi? Following the great suggestion of Damon Dudek I came across the error below: public class…
-
2
votes1
answer810
viewsCreation of a Header that is used in the communication of a Webapi
I am creating a program that communicates with a webapi and is giving me this error in creating the header. I’m using this to create the header : var tempo =…
-
2
votes2
answers42
viewsHow to create a date header but in the form of ISO 8601
I’m creating a communication with a web api and I needed to create a header date type but formatted to ISO 8601. What I want is to get the following output : Date: 2017-09-13T08:21:08Z My code is…
-
2
votes1
answer664
viewsHow to deploy an Asp.Net Core Web API project to IIS?
Hello, I’m trying to put my application ASP.NET WEB API on the IIS of the Windows Server 2016 server, but without success. When accessing url ex: http://localhost:8080 returns this error: HTTP Error…
-
2
votes1
answer624
viewsButton on a View with MVC/Web API
When we put a button in a View, how do we fire a click of it? I have this button: @model IEnumerable<CarregaDados.Models.Cliente> @{ ViewBag.Title = "Index"; } <h2>Index</h2>…
-
2
votes1
answer299
viewsError: Multiple controller types Were found that match the URL
When requesting a service by my App, gives me this error: Multiple controller types Were found that match the URL. This can if happen attribute Routes on Multiple controllers match the requested…
-
2
votes3
answers679
viewsEntity Relationship Framework 1:N
Hello. I have the following classes... Sales class: [Table("venda")] public class Vendas { public Vendas() { ItensVendas= new List<ItensVendas>(); } [Key] public int Id { get; set; } public…
-
2
votes5
answers371
viewsValidate model before inserting in the database
I am developing a Webapi using Entityframework6. Before performing an INSERT in the database, I would like to validate the model that is coming via request (I believe to be fundamental), but I have…
-
2
votes1
answer1121
viewsPostasjsonasync Failure - Webapi - C#
I made a WebAPI that by Postman I can make a CRUD but I created a Windows Forms C# pelo Visual Studio and I’m having some problems. I can give a get and all my data is searched perfectly, only that…
asp.net-web-apiasked 6 years, 9 months ago joaop.mr 21 -
2
votes1
answer328
viewsWeb API does not accept parameters in the constructor with Autofac
I created an API to query client, this is my configuration: public static class AutofacWebapiConfig { public static IContainer Container; public static void Initialize(HttpConfiguration config) {…
-
2
votes3
answers120
viewsProperty defined in constructor only returns zero value
I created a Web API in C# that returns me a list of products in JSON. However, the property PrecoVenda is always returned with the value zero and I noticed that this occurs because in the class…
-
2
votes1
answer1598
viewsRemote server returned an error: (400) Incorrect Request
I created two methods, one for authentication via A1 and A3 type certificate and one for sending an xml, both of which request a client’s Rest api. In the authentication method, I send my…
-
2
votes2
answers1139
viewsGet Solution Folder C#
I have a solution with 4 projects inside. In my controller I need to open an HTML that is inside another project, but I can’t open the file folder. Below follows print with my structure: The class…
-
2
votes1
answer107
viewsI’m not getting a list of an API
This URL works on Postman: http://localhost:56137/api/Getcidade. I need now in another MVC project to bring the list of cities. When I do this I catch this mistake: The template item inserted in the…
-
2
votes2
answers86
viewsLimit index query but not combo query
Good afternoon, In the company’s ERP we have a query in the Index that is limited to 80 records. The problem is that in create we have combos that bring more than 150 records and is also limiting to…
-
2
votes2
answers745
viewsPass more than one parameter in a request in Angular for Webapi
This is the web api: [Route("{pagina:int}/{tamanhoPagina:int}")] [HttpGet] public IHttpActionResult UsuarioPaginado(int pagina = 1, int tamanhoPagina=10) { var _aluno = iAluno.Listar() .Where(x…
-
2
votes0
answers77
viewsProblem running a function in Asp.net.core.webapi + postgresql + npgsql+Dapper
I have a Webapi in Asp.net core, using postgresql as a database. Inside postgresql, I have the following function: CREATE OR REPLACE FUNCTION evento_distancia( IN lat numeric, IN lng numeric, IN…
postgresql asp.net-web-api asp.net-core dapper npgsqlasked 5 years, 8 months ago Thiago Oliveira 147 -
2
votes1
answer35
viewsDon’t call class Startup, Owin
My API is not calling my Startup class, therefore it does not call my controller via Postman. Startup [assembly: OwinStartup(typeof(GestaoFrotas.Security.API.Startup))] namespace…
-
2
votes1
answer64
viewsError in API POST when inserting object
Hello, I am trying to add an object to the database by calling my API and I get this error: ORA-00932: inconsistent datatypes: expected NUMBER got NCLOB I just wanted some help with directing,…
-
2
votes1
answer217
viewsCannot convert implicitly type "System.Collections.Generic.Ienumberable<SS_API.Model.Project>"
Cannot convert type implicitly "System.Collections.Generic.IEnumberable<SS_API.Model.Project>" em…
-
2
votes0
answers23
viewsHow to update a subdocument in a mongoDB document with Findoneandupdateasync
I’m trying to add a subdocument to a mongoDb document, but even looking at the previous posts I couldn’t find a solution. My classes public class UserClass { [BsonId]…
-
1
votes1
answer398
viewsWeb API 2 - Use of Reasonphrase in exception handling
var resp = new HttpResponseMessage(HttpStatusCode.NotFound) { ReasonPhrase = "Nenhum produto encontrado" }; throw new HttpResponseException(resp); That code should return 404 No products found But…
-
1
votes1
answer570
viewsFormat JSON wrong web api
I’m having trouble returning json to my mvc 5 api. In the Get method it returns a string in this format: public string Get() { return…
-
1
votes1
answer440
viewsWebapi view content in a view
Hey, guys, all right? I am developing my first application in web api asp.net. And I’m having trouble displaying the content on a view. Controller: public class ListaPresenteController :…
-
1
votes2
answers1173
viewsHow to use folder to store images in a Web Api project published in Windows Azure?
I have a folder created at the root of a project Web Api calling for Images. In localhost I record them as follows: File.WriteAllBytes(HttpContext.Current.Server.MapPath("~/Images/") + image.Name,…
-
1
votes1
answer258
viewsHow to create subfolders for Api on Asp.net webapi?
By default, the folder is Controllers I would like to create other subfolders Controllers -> Api -> Othern/ Other2 etc How do I do this? and how do you configure the router for this?…
asp.net-web-apiasked 10 years, 2 months ago Rod 9,412 -
1
votes1
answer122
viewsVariables in a JSON
Is there any way to vary the value of a JSON? Let’s look at an example: I have the following JSON { "ISteamClient": 0, "ISteamFriends": 0, "ISteamUser": 0, "IEconItems_440": 0, "IEconItems_730": 0,…
-
1
votes1
answer814
viewsCalling methods in controller class (Asp.net web.api) to work when changing parameter name
I have a question regarding the use of the Asp.net web api with Angularjs that follows below. I have 2 methods in my controller class (Itenscontroller.Cs): public void Put(int id, [FromBody]Item…