我希望设置Web控制器,这样我就可以像jQuery post一样访问它们,这样我就不必创建jQuery类,而且我的Web可以在将来与jQuery一起使用。Q:如何在不使用C#类的情况下,从C#客户端发布到自托管Web控制器的辅助角色?我以前使用过Web,它托管在一个常规的ASP.NET项目中,我可以通过jQuery访问它,这样做如下:public class TestCo
我正在尝试使用ajax调用方法向C#WebAPI发送一些数据,它使用'GET方法‘工作得很好。到目前为止,这是我的代码,但当我尝试使用’POST‘传递参数时,我得到了404 Not found错误: type: "POST", //GET or POSTsuccess: function (result) {//On Successful service call
我有一个克隆记录的端点,但要做到这一点,我只需要使用一个Id。因为我只需要使用一个Id,所以我编写了这个端点: [HttpPost][SwaggerResponse(HttpStatusCode.OK, description: "Clone an existing record", type: typeof(int))]{
var newId = _service.DoSometh
我在MVC中调用WebAPIpost方法Restsharp C#。下面是webapi和控制器方法的代码。object EncodeDecodeString([FromBody]string data) // data value is coming null.} 正在调用WebApi。var clientR = new RestClient("https:/
POSTing value into a WebAPI method using a standard jQuery $.post的C#(from the controller(MVC))中的等价物是什么我使用一个标准的jQuery $.post让它工作,如下所示:
$.post('/api/reports', { AgentId: AgentId, ReportName: ReportName,