webmethod

Invalid web service call, missing value for parameter

人盡茶涼 提交于 2019-12-22 08:59:57
问题 I have been looking at this for a while and can't see where the problem is. Any help is greatly appreciated. [WebMethod(true)] [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)] public static string neighbourhoodTeam(string force, string neighbourhood) { //StreamManager streamMan = new StreamManager(); //return streamMan.StreamManagerUrlHandler("http://policeapi2.rkh.co.uk/api/" + force + "%2F" + neighbourhood + "%2F" + "people"); return neighbourhood + force; } jQuery:

Using Jquery and AJAX to pass parameters to VB.NET webmethod

江枫思渺然 提交于 2019-12-21 20:49:15
问题 I've been searching the internet for hours trying to pass parameters to my code behind using JQUERY $.ajax. I've tried a ton of different things, but nothing has worked. When I don't pass any parameters and set the vb.net function to not receive parameters the functions will get called. But once I try adding parameters, the function never gets called. Client Side: $("#<%=saveResource2.clientID %>").click(function() { var parDesc = $("#<%=ddlPDesc.clientID %> option:selected").text(); $("#<%

Service AJAX requests with webmethod in ASPX page

家住魔仙堡 提交于 2019-12-21 17:22:49
问题 I am trying to service AJAX requests with a method in my .aspx page. For some reason I am not getting the data returned that I want. Can anybody tell me what I am doing wrong? mypage.aspx: <%@ Page Language="VB" Title="My Page" %> <%@ Import Namespace="System.Web.Services" %> <%@ Import Namespace="System.Collections.Generic" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page

Should I be using Web API vs Web Methods?

大城市里の小女人 提交于 2019-12-21 09:15:22
问题 I'm trying to understand web api and some news about web methods. I've heard that we should stop using web methods from a few sources. Additionally, is Web API the successor if web methods should no longer be used? 回答1: Web methods are part of the ASMX technology. ASMX is a legacy technology, and should not be used for new development. WCF or ASP.NET Web API should be used for all new development of web service clients and servers. One hint: Microsoft has retired the ASMX Forum on MSDN.

how to use webmethod with telerik batch edit grid

白昼怎懂夜的黑 提交于 2019-12-20 07:31:28
问题 Work on Asp.net vs2012 C# telerik:RadGrid batch edit,I put save button outside from the grid.Under the save button want to call webmethod to save all changes on my db. Sample will be preferable,how to use webmethod with batch edit grid. 回答1: Use RadClientDataSource to bind to your service: http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/client-data-source-binding/defaultcs.aspx 来源: https://stackoverflow.com/questions/28870389/how-to-use-webmethod-with-telerik-batch

The Correct way to pass FileUpload content into [WebMethod]?

你说的曾经没有我的故事 提交于 2019-12-20 05:17:14
问题 I have a [WebMethod] Sendemail This works fine but now i what to upgrade it to send attachments. I am using a fileupload. This is my method Call. lblEmailSent.Text = Send.Sendemail(txtTo.Text, txtSubject.Text, txtbody.Text, FileUpload1.PostedFile.FileName, FileUpload1.FileContent); My Call Statement is underlined in blue and the two error given look like: * 1) *The best overloaded method match for 'WebTestServiceApp.localhost.Service1.Sendemail(string, string, string, string,

AJAX to web method not returning JSON

假如想象 提交于 2019-12-20 04:21:11
问题 I am calling a web method in aspx page from my js file using AJAX. I have set the method to be [WebMethod] and the page inherits from System.Web.Ui.Page class. Still it does not return the JSON format to my calling ajax function. Here is the AJAX call in js file: $.ajax({ type: "POST", url: "/WebServiceUtility.aspx/CustomOrderService", data: "{'id': '2'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (message) { ShowPopup(message); } }); function

Why Can WebMethod Access Session State Without EnableSessionState?

北城余情 提交于 2019-12-19 12:55:00
问题 I have a method on a page marked as a [WebMethod] that uses some session state as part of its operation. After I wrote this code, I suddenly had a flash of memory that you need to use EnableSessionState when you use session state in a [WebMethod] (e.g. see here: http://msdn.microsoft.com/en-us/library/byxd99hx.aspx). But it seems to be working fine. Why? Sample code behind: protected void Page_Load(object sender, EventArgs args) { this.Session["variable"] = "hey there"; } [System.Web.Services

WebMethod in ASP.NET global error handler: how to trap values passed in AJAX POST request

﹥>﹥吖頭↗ 提交于 2019-12-19 11:27:54
问题 Stated another way, using HttpContext, how can I retrieve the parameters passed to a [WebMethod] when in a global error handler? Kovu gives a great example of how to do a global error trap to grab [WebMethod] errors in Global.asax, which I think he got from Richard Liu here, but his solution does not capture the parameters passed to the WebMethod, and I really need to log these to repro the errors. I adapted Richard/Kovu's example to start trapping more things about the request, but I just

Call a WebMethod passing Dictionary<string, string> as parameter

為{幸葍}努か 提交于 2019-12-19 09:01:14
问题 I am trying to streamline the process of returning the data from my WebMethod layer to the client and represent the set of parameters in coming from the client in a Dictionary<string,string> to do something like this: [WebMethod(EnableSession = true)] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static override ResultObject<List<PatientInfo>> GetResults(Dictionary<string, string> query) { ResultObject<List<PatientInfo>> resultObject = null; if (!query.ContainsKey("finValue")) {