37,950 questions
1
vote
2
answers
22k
views
How to consume an asp.net web api in vb.net application
Just like my original question states.
I was wondering in there is a was in vb.net to consume an asp.net web api.
I'm a beginner asp.net programmer.
I'm watching videos on how to make the web api.
...
14
votes
1
answer
9k
views
Compress requests from Angular to web API
I am trying to optimize bandwidth usage by compressing requests from my angular client to a AspNet Web API. Is there any way to achieve this?
Advice
0
votes
2
replies
41
views
Deploying ASP.NET API and ASP.NET MVC app on the same IIS default site
I have this scenario: I have an ASP.NET API which is deployed on IIS under the default web site. I have added the API by right click on default web site -> add application. API is working fine and ...
123
votes
5
answers
231k
views
Error :Request header field Content-Type is not allowed by Access-Control-Allow-Headers
I created an mvc4 web api project using vS2012. I used this tutorial to solve the Cross-Origin Resource Sharing. It is working successfully, and i post data from client side to server successfully.
...
2
votes
2
answers
3k
views
role based access with jwt and a lot of roles
I have a web api with many controllers. With those controllers i defined a lot of roles and decorated the controller/functions. To access the api i use jwt.
I tried to write my roles into the jwt ...
103
votes
25
answers
171k
views
How to configure Swashbuckle to ignore property on model
I'm using Swashbuckle to generate swagger documentation\UI for a webapi2 project. Our models are shared with some legacy interfaces so there are a couple of properties I want to ignore on the models. ...
1
vote
4
answers
9k
views
Microsoft Graph API daemon - Error: ResourceNotFound Message: Resource could not be discovered
I'm trying to create a daemon using Microsoft Graph API v1.0.
I've registered my app with application permission Calendars.ReadWrite and User.Read.All with granted admin consent.
I get the access ...
19
votes
3
answers
33k
views
Best way to have one Web API forward request to other
I have a few web services running on different servers, and I want to have one web service running "in front" of the rest to decide which web service (server) the request should be forwarded to based ...
18
votes
5
answers
12k
views
How to Logout user from Spotify after authorization and Web API call is over
Im using Spotify Web API to get list of playlist and track of user. Authorization is working fine. Also i do get track details. But after that I want to logout user from spotify and allow new login .
...
4
votes
1
answer
3k
views
How to write integration test for asp.net web api
I am busy design a web service with asp.net web api. And I want to start doing unit tests on each controller.
here is my test class so far:
[TestClass]
public class MyDevicesControllerTest
{
[...
0
votes
3
answers
9k
views
Post data through Url to webapi
Hej,
I am unable to post data to the action method through querystring to the action method which is located in the controller class below is my code.
I type a url "http://localhost:53459/api/esb/...
5
votes
1
answer
9k
views
ASP.NET Web API - Getting AspNetInitializationExceptionModule after deployment
I wrote REST service using ASP.NET Web API
I’ve also set “copy local” property of the below libraries to true.
System.Web.Mvc System.Web.Routing System.Web.Abstractions
I deployed it using visual ...
1
vote
2
answers
1k
views
Unable to hide or block displaying appsettings.json on the browser
I am using ASP.net Core 3.1 and trying to make appsettings.json inaccessible on the browser i.e. when I am typing https://myapp/appsettings.json, it's showing the contents of appsettings. I want to ...
15
votes
6
answers
62k
views
How to open a pdf in new tab in reactjs? [duplicate]
We have the pdf document save in data base , from webapi I am returning as byte array,Now from UI I have to open the pdf in new tab of browser, and user should able to download the pdf.
How can I ...
3
votes
1
answer
10k
views
Way to debug request to Web API controller
I have simple console application, which send json data to controller.
Client.PostAsJsonAsync("http://[site].azurewebsites.net/api/Decision", report);
And controller:
public class DecisionController ...
195
votes
5
answers
228k
views
Logging request/response messages when using HttpClient
I have a method that does a POST like below
var response = await client.PostAsJsonAsync(url, entity);
if (response.IsSuccessStatusCode)
{
// read the response as strongly typed object
...
306
votes
11
answers
203k
views
Exposing localhost to the internet via tunneling (using ngrok): HTTP error 400: bad request; invalid hostname [closed]
From previous versions of the question, there is this: Browse website with ip address rather than localhost, which outlines pretty much what I've done so far...I've got the local IP working. Then I ...
75
votes
24
answers
170k
views
All ASP.NET Web API controllers return 404
I'm trying to get an API Controller to work inside an ASP.NET MVC 4 web app. However, every request results in a 404 and I'm stumped. :/
I have the standard API controller route from the project ...
1
vote
2
answers
12k
views
CORS preflight OPTIONS request returns 401 (Unauthorized) from Windows Authenticated web api
I've got a .NET Web API project using Windows Authentication. In my development environment, I can't do a successful POST request with data from my Angular app. It returns:
OPTIONS http://localhost:...
23
votes
2
answers
9k
views
owin cors or web api cors [closed]
there are 100s of question on CORS on web-api, and on how to enable CORS, there is a different answer each one provides. I am so confused and don't know which answer is correct. And the problem is ...
0
votes
1
answer
15k
views
Get data from Web Api in C#
I am using a Web Api with the following data in a controller.
public IEnumerable<string> Get()
{
return new string[] { "Item1", "Item2s", "Item3", "Item4", "Item5" };
...
9
votes
2
answers
7k
views
.NET 6 HttpLogging RequestBody in is always empty in log
I use HttpLogging to log requests coming to my endpoints. I would like to log the whole request. I setup the HttpLogging in Program.cs
builder.Services.AddHttpLogging(logging =>
{
logging....
0
votes
0
answers
71
views
How to return data annotations error message in one string?
I'm using data annotations from System.ComponentModel.DataAnnotations in my ASP.NET project. I get an error message where you can describe the requirements such as "Name is required" and etc....
4
votes
1
answer
9k
views
Export To Excel from Asp Net Web API Controller
I am working on New web application which is Using Web API as Business Layer and Knock out Js as client side frame work to binding. I have a requirement like Pass the certain search criteria to Web ...
101
votes
34
answers
275k
views
HTTP 404 Page Not Found in Web Api hosted in IIS 7.5 [closed]
I have a Web Api application. It works perfectly well when I tested it using the VS 2010 debugging dev server. But I now deployed it to IIS 7.5 and I am getting a HTTP 404 error when trying to access ...