asp.net-web-api

how to return multiple files from asp.net web api

南笙酒味 提交于 2020-01-06 13:53:05
问题 I'm trying to write an asp.net Web Api Restful service by means of which I need to send (.html,.css,.js,.png images) files (and all these files are part of a little JQuery mobile application written using Visual Studio 2013 with new multi device hybrid thing .i.e. Cordova extensions) to the mobile client within one request. I'm stuck with two questions in my head. First how to send these files to the client within one request. Do I need to zip them up and then return to the client? If zipping

how to return multiple files from asp.net web api

萝らか妹 提交于 2020-01-06 13:52:58
问题 I'm trying to write an asp.net Web Api Restful service by means of which I need to send (.html,.css,.js,.png images) files (and all these files are part of a little JQuery mobile application written using Visual Studio 2013 with new multi device hybrid thing .i.e. Cordova extensions) to the mobile client within one request. I'm stuck with two questions in my head. First how to send these files to the client within one request. Do I need to zip them up and then return to the client? If zipping

how to return multiple files from asp.net web api

做~自己de王妃 提交于 2020-01-06 13:52:05
问题 I'm trying to write an asp.net Web Api Restful service by means of which I need to send (.html,.css,.js,.png images) files (and all these files are part of a little JQuery mobile application written using Visual Studio 2013 with new multi device hybrid thing .i.e. Cordova extensions) to the mobile client within one request. I'm stuck with two questions in my head. First how to send these files to the client within one request. Do I need to zip them up and then return to the client? If zipping

What are the pros and cons of having a WebAPI in the same or different project [closed]

孤街醉人 提交于 2020-01-06 13:09:33
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I have an MVC application and the solution consist of three project as described below: Store.Domain : Holds the domain entities and logic (repositories created with the Entity Framework). Store.WebUI : Holds the controllers and views; acts as the UI for the application.

Converting simple value to JSON in ASP.NET Core API

大兔子大兔子 提交于 2020-01-06 08:12:18
问题 Sometimes my ASP.NET Core API needs to return a simple value i.e. bool , int or string even though in most cases, I return complex objects/arrays as JSON . I think for consistency purposes, it's a good idea to return even simple values as JSON . What's the easiest way to convert a simple value, whether it's bool or int into JSON ? My standard controller action looks like this -- see below -- which gives me the ability to return status codes as well as data. Therefore, I'd like to stick to

Multiple GET verb on single route with different parameter name Web Api

我怕爱的太早我们不能终老 提交于 2020-01-06 08:04:28
问题 How can possible to call different-different action on basis of parameter name using single route. I need following /api/v1/user GET key=dfddg&secret=fafassaf&query=select id from user where user like '%ggg%' and /api/v1/user GET key=dfddg&secret=fafassaf&ids=fadfdafdsf,faffasfasfsf,asfasfasfasfas,asfasfasfasf I have written following code [RoutePrefix("api/v1/user")] public class UserController : ApiController { [GET("")] public String GetAllUsers(String key, String secret, String query) {

The configuration section 'httpErrors' cannot be read because it is missing a section declaration

吃可爱长大的小学妹 提交于 2020-01-06 07:38:07
问题 I am trying to configure a custom error page for the 403 Forbidden response in my WebApi application by adapting Example of Configuration for <httpErrors>. I added <httpErrors> to my Web.config but I'm getting HTTP Error 500.19 and The configuration section 'httpErrors' cannot be read because it is missing a section declaration . How can I fix it? My code: <system.web> .... <httpErrors errorMode="Custom"> <remove statusCode="403" subStatusCode='-1' /> <error statusCode="403" path="/forbidden

ASP.NET Web API Controller output is always buffered

人盡茶涼 提交于 2020-01-06 06:54:06
问题 How to send output without buffering? I defined my API controller this way: public class DefaultController : ApiController { [HttpGet] [Route] public HttpResponseMessage Get() { var response = Request.CreateResponse(); response.Content = new PushStreamContent( (output, content, context) => { using (var writer = new StreamWriter(output)) { for (int i = 0; i < 5; i++) { writer.WriteLine("Eh?"); writer.Flush(); Thread.Sleep(2000); } } }, "text/plain"); return response; } } Output appears in the

Web API project fails to load in Visual Studio 2019 - error: 'The method or operation is not implemented'

[亡魂溺海] 提交于 2020-01-06 05:39:08
问题 I have a ASP.Net Web API project that is failing to load in Visual Studio 2019. When I try to reload the project from the Solution Explorer I get the error: The method or operation is not implemented Any ideas what might be causing this? 回答1: A bit of a cryptic error message - the actual problem preventing the project from loading was: In the csproj file for the project, section, I had <UseIIS>true</UseIIS> and IISUrl pointing to a local site that was not yet set up on IIS, e.g. <IISUrl>http:

Send Angular (6) client side errors to web API for logging

妖精的绣舞 提交于 2020-01-06 05:31:08
问题 Another person asked my exact question here with no answer: Angular 2 Client Side Errors I'm wanting a way (avoiding additional third party frameworks if possible) to send my client-side Angular errors to my back end exception logger. My back end is just a .NET Web API project that's connected to our SQL Server database. My server side errors are currently being logged to the database by calling a stored procedure controller whenever a server error occurs (I used KudVenKat's tutorial to build