Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
2 answers
86 views

I've been trying to send a 'forgot password' email for my website. I am using a template html file with replaced text to send new randomized credentials to a user. I have so far been unable to send ...
Asad Koths's user avatar
0 votes
0 answers
39 views

I am trying to generate a sitemap.xml file form MAUI hybrid app in C#9 I have created a sitemap1 page which renders a static sitemap but I am getting error. @page "/sitemap1" @inject ...
Ali's user avatar
  • 1,285
0 votes
1 answer
201 views

I wish to add a custom header parameter in Swagger for all my endpoints in my ASP.NET Web API application running ASP.NET 4.8 using NSwag. I have found many, many references explaining how to do this ...
Dale K's user avatar
  • 28.1k
48 votes
2 answers
80k views

System.Net.Http.Json's HttpClient extension methods such as GetFromJsonAsync() greatly simplifies the routine codes to retrieve json objects from a web API. It's a pleasure to use. But because of the ...
thankyoussd's user avatar
  • 2,551
156 votes
10 answers
224k views

Here's the call to the PUT method on my Web API - the third line in the method (I am calling the Web API from an ASP.NET MVC front end): client.BaseAddress is http://localhost/CallCOPAPI/. Here's ...
Mike Marks's user avatar
  • 10.1k
147 votes
7 answers
94k views

In ASP.NET there is a System.Web.HttpRequest class, which contains ServerVariables property which can provide us the IP address from REMOTE_ADDR property value. However, I could not find a similar ...
paulius_l's user avatar
  • 5,003
30 votes
8 answers
65k views

Well, I'm using Swagger for my API documentation and it works perfectly in localhost, the problem begins when I host it on the IIS. For somereason it just doesn't work anymore localhost: https://...
Pedro Leal's user avatar
91 votes
16 answers
223k views

I know that I can use Url.Link() to get URL of a specific route, but how can I get Web API base URL in Web API controller?
Nikolai Samteladze's user avatar
2 votes
1 answer
206 views

I am creating an ASP.NET Web API gateway which needs to communicate to legacy COM component business logic written in C++. So I am creating another Web API which internally gets data from COM ...
srajeshnkl's user avatar
101 votes
12 answers
222k views

I've got the following action on an ApiController: public string Something() { return "value"; } And I've configured my routes as follows: routes.MapHttpRoute( name: "DefaultApi", ...
Josh Schultz's user avatar
  • 8,190
86 votes
8 answers
102k views

I have a simple .net core web api with one action: [Route("[action]")] public class APIController : Controller { // GET api/values [HttpGet] public string Ping() { return ...
Calanus's user avatar
  • 26.4k
162 votes
6 answers
64k views

I'm using Web API 2 and I'm getting the following error when I send a POST to my API method using IIS 7.5 on my local box. The inline constraint resolver of type 'DefaultInlineConstraintResolver' was ...
Halcyon's user avatar
  • 15k
55 votes
3 answers
49k views

In ASP.NET Core 6 default template moves everything from Startup.cs into Program.cs, and uses top-level statements in Program.cs, so there's no more (speakable) Program class ether. That looks awesome,...
maxc137's user avatar
  • 2,841
137 votes
12 answers
220k views

I am starting to use MVC4 Web API project, I have controller with multiple HttpPost methods. The Controller looks like the following: Controller public class VTRoutingController : ApiController { ...
Habib's user avatar
  • 224k
210 votes
4 answers
249k views

Why are the FromBody and FromUri attributes needed in ASP.NET Web API`? What are the differences between using the attributes and not using them?
Rajneesh's user avatar
  • 2,109
133 votes
8 answers
216k views

In my Angular JS project, I've an <a> anchor tag, which when clicked makes an HTTP GET request to a WebAPI method that returns a file. Now, I want the file to be downloaded to the user once ...
kelsier's user avatar
  • 4,108
0 votes
0 answers
47 views

I am running an ASP.NET Web API application for .NET Framework 4.7.2, and when I try to run it in on my Windows 11 dev machine via IIS Express, the app is crashing with the following error: HTTP ...
David Keaveny's user avatar
135 votes
8 answers
165k views

I made a console app to consume a Web API I just made. The console app code does not compile. It gives me the compilation error: 'System.Net.Http.HttpContent' does not contain a definition for '...
Water Cooler v2's user avatar
1 vote
1 answer
108 views

The ASP.NET Web API template contains a sample method: public IEnumerable<WeatherForecast> Get() { return Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = ...
Megrez7's user avatar
  • 1,477
118 votes
13 answers
142k views

I have a strange error. I'm experimenting with a .NET 4.5 Web API, Entity Framework and MS SQL Server. I've already created the database and set up the correct primary and foreign keys and ...
Lydon's user avatar
  • 2,975
1 vote
0 answers
65 views

My api depends on some programs that are expensive to start up for each call. I am trying to inject a cache that contains the cached objects wrapping the programs so they can be reused without killing ...
Jeppe's user avatar
  • 1,575
0 votes
0 answers
47 views

I am working on a legacy Web Forms project written in VB.net. When an authorized client makes a bad request, my application response returns a full stack trace that I want to hide. I have a redirect ...
blitzchap's user avatar
0 votes
1 answer
404 views

I'm trying to schedule an Outlook appointment to another user's calendar using Microsoft Graph API in my ASP.NET Web API, written in C# and running on .NET 4.8.1. When I run the API code shown here, ...
Brandon 's user avatar
0 votes
1 answer
108 views

I have a third-party React page which makes some API calls to .NET backend. I need a way to restrict people from hacking API by changing values of the request. When someone opens the third-party page ...
Shivanka's user avatar
  • 743
117 votes
9 answers
107k views

UPDATE Thanks for all the answers. I am on a new project and it looks like I've finally got to the bottom of this: It looks like the following code was in fact to blame: public static ...
Tom's user avatar
  • 8,200