Questions tagged as 'asp.net-web-api'

1
answer

Web API does not accept parameters in constructor with Autofac

I've created an API to query client, this is my configuration: public static class AutofacWebapiConfig { public static IContainer Container; public static void Initialize(HttpConfiguration config) { Initialize(config, Regi...
asked by 23.03.2018 / 15:17
5
answers

Validate model before entering bank

I'm developing a WebAPI using EntityFramework6. Before performing an INSERT in the database, I would like to validate the model that is coming via the request (I believe it is fundamental), but I do not have experience with good data validati...
asked by 09.02.2018 / 16:07
1
answer

Creation 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 = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ"); var httpWebRequest = (HttpWebRequ...
asked by 08.09.2017 / 17:55
1
answer

Asp.Net Razor with Json

I have a question and I already researched several sites but I did not get the answer. I develop systems in .Net with C # in the MVC standard and use the on-screen presentation in the traditional View with Razor form. It turns out that I ha...
asked by 05.04.2017 / 18:21
1
answer

How to catch an error occurred on a webapi server?

I have a server running a WebAPI service, on the client I run the call to a POST URL like this: try { HttpWebRequest request; request = (HttpWebRequest)WebRequest.Create(URL); request.Method = "POST"; request.Proxy = null; req...
asked by 21.05.2015 / 00:09
1
answer

Save entities with one-to-many relationship using WebAPI

I'm starting a WebApi project and I came across a situation that I did not know how to set my Controller class. I have the following structure public class Artigo { public int ArtigoId { get; set; } public int AutorId { get; set...
asked by 29.04.2014 / 19:29
2
answers

Get folder of solution 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 not open the file folder. Below is the following with my structure: TheclassfileistheUtils.cscontrolleriswithin1-S...
asked by 28.05.2018 / 14:46
2
answers

API 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     
asked by 13.11.2017 / 17:57
1
answer

Error: Multiple controller types were found that match the URL

When requesting a service from my App, give me this error:    Multiple controller types were found that match the URL. This can   happen if attribute routes on multiple controllers match the requested   URL. \ R \ n \ r \ nThe request has fou...
asked by 08.11.2017 / 20:15
1
answer

The remote server returned an error: (400) Incorrect request

I have created two methods, one for authentication via certificate type A1 and A3 and another to send an xml, both of which make the request in a client apiect. In the authentication method, I send the data from my certificate to the client a...
asked by 27.04.2018 / 15:45