How to get data directly from request.form.file[0] instead of copying it to server ?
I work on c# 7 I face issue I can't get data from file Request.form.file[0] directly it must copying to server to get data from it so can i get data from variable DisplayFileName instead of get data from input path after copying to server below is my…
Using Gmail And Web Api To Send Email Failing
I am currently busy with a Web Api allication that sends emails using the credentials from my gmail account. I have the following in my webconfig file <mailSettings> <smtp from = "mygmailemailaddress" > <network…
C# - Making sync function to async
Hi, I am just wondering if below code changes (New Code) make any difference in performance with respective to calling cosmos from a web api Old Code: public string GetDocs() { return JsonConvert.SerializeObject(CreateDocumentQuery().ToList());…
Web Api Still Getting Cors Errors After Installing Microsoft.AspNet.Cors And Enabling Cors On Controller
I am buildind a Web Api app locally and I am calling the methods using simple jQuery ajax method calls. As per the title I have installed the Microsoft.AspNet.Cors package via nuget and enabled cors in my WebApiConfig.cs and on my controller like this …
c# Asp Web API: HttpException: Maximum request length exceeded.
This might be a common question, but my situation is not so common. I an sending a serialized image into an Asp.net Web API method and am getting this error: System.Web.HttpException: Maximum request length exceeded. at…
Conversion from .NET framework 4.6 to 4.8
I have converted my web api framework target from 4.6.2 --> 4.8, this is the error I get after I change target framework and reinstalling nuget packages:- The type initializer for 'System.Web.Http.GlobalConfiguration' threw an exception.. error…
Request help on connecting webapi from azure relay
Hi Team, We need some help on the below enhancement. We have an existing asp.net webapi hosted in iis. We are using mysql as a backend. We need to use azure relay-mostly hybrid connection, to call the webapi. Note: we don't want…
ASP.NET Web API: Mock authorization, headers in Unit Test
Hi All, I have to mock the authorization and headers while calling controller action in the Unit test method. ValueController.cs ( ASP.Net Web Api(.Net Framework 4.6.1) Public async Task<HttpResponseMessage> ValueProcessMessageAsync() { …
Select only few columns from a table to map with Odata Select query on C# Web API
We have a table in the database which has multiple columns. We only want a query which will return only requested columns. These requested columns will from Odata Select Query requested using C# Web API. For Example, I have an EmployeeTable which has…
Passing an Interface as a parameter to Web API method
Hi All, I would like to know how can I pass an interface as a parameter to a Web API method. Here's my interface: public interface IPerson { string Gender { get; set; } decimal Weight { get; set; } } I am sending this information…
Web api hosting
Hello everyone, I am new to web api. I have this simple question about web api host. So here is how a client application consume the web api: public class StudentController : Controller { // GET: Student public ActionResult Index() { …
How to serialize objects into XML C#
I have written a simple webAPI program which returns JSON by default when running , I want the values in XML format so I tried below code it always returns string for me, have also tried multiple solution from this stackoverflow post but all returns…
![](https://techprofile.blob.core.windows.net/images/EfU10ek1U0WlC11kUgpyJw.png?8D934E)
Response code 400 in Asp.net core 3.1 version
I am getting 400 response code in Asp.net core web api on POST Save method Controller/Save ,i just recently upgraded .net core web api version to 3.1 [HttpPost] [ContentValidation("Shell.xsd")] [Authorize(Policy =…
Azure Identity Platform - Authenticate logged in user against Custom WebAPI Endpoint using ReactJS Client
Hi. We have a dotnet Aspnet WebAPI based API using .Net Framework 4.7.2 which we access using a ReactJs client Application. We want to authenticate users logged in as an Azure AD user against our API. Our question is as follows: How do we set up our…
CreatedAtAction doesn't work
I need to get a URL with CreatedAtAction but get a null. My searches did not yield any results. **My controller** namespace GeoService.Controllers { [Route("api/continent/{continentId}/country/{countryId}/City")] …
c# HttpClient 400 Bad Request when using https
I'm trying to get a web request working using HttpClient. It works when using http, but does not work with https. The URL I'm testing with works in a browser with both http and https, however, when using the code below it works only with http. Do I…
Cannot edit a web application
Hi I have asp.net web application, I try to edit the code but the content of the site does not change, I tried to convert the web application to a web site but another error appears instead of displaying GDI+ graphics showing a black screen and one…
![](https://techprofile.blob.core.windows.net/images/Tq9DX2gkAQAAAAAAAAAAAA.png?8D90B2)
WebAPI Get autogenerated ID of a just created (posted) record
Good afternoon, I have a web API running just fine and a Xamarin forms app on top of it. There I want to create 1:N relation which is fine in the model but I have the following problem: (I don't want to post all the code here so I bring it down to…
![](https://techprofile.blob.core.windows.net/images/PfD0TTJBaEWMsCpKFC2DVw.png?8D8FA0)
![](https://techprofile.blob.core.windows.net/images/PfD0TTJBaEWMsCpKFC2DVw.png?8D8FA0)
Caching Token in SOAP-based Web Service
I developed a SOAP-based web service for internal consumption. It takes a SOAP-based web request and converts it to a JSON-based external, third-party RESTful web API request. It then takes the JSON-based external, third-party RESTful web API response…
![](https://techprofile.blob.core.windows.net/images/t7GFq0Uwb0Syds_CHPx8dw.png?8D8DF1)
how to create api to get orders from Shopify and post to my database
I want to build an api , where I should be able to get list of new orders from shopify each time an order is created in shopify and post that order details into my database. I have a rough idea on api, but not sure how to start to work on it. Can…