webmethod

How to get SessionID on a request where EnableSessionState=“False”

风流意气都作罢 提交于 2019-12-05 14:19:35
I want to be able to get the SessionID of the currently authenticated session in a WebMethod function where EnableSession = false . I cannot set EnableSession=true on this request, because another (long running) request on a different page is keeping the SessionState locked (EnableSessionState == "True" not "Readonly"). Is there a consistent way of getting the SessionID from either the ASP.NET Session cookie or the Url for cookieless sessions? I can code it myself but I would rather use a function that is already documented and tested. Thank you very much, Florin. There seems to be no ASP.NET

Testing a web method (with browser/Fiddler)

余生颓废 提交于 2019-12-05 13:19:51
I'm trying to implement the Jquery autocomplete by DevBridge( http://www.devbridge.com/projects/autocomplete/jquery/ ). This makes an AJAX call and in their example it uses a .NET web service. I am planning on using a web method. I've created a page called WebMethodTest.aspx and added a simple web method to it. Code is as follows: using System; using System.Web.Services; public partial class WebMethodsTest : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } [WebMethod] public static string Test() { return "blah blah blah"; } } I've added nothing to the web.config or

Invalid web service call, missing value for parameter

拜拜、爱过 提交于 2019-12-05 11:55:26
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: function getOfficers(force, neighbourhood) { $.ajax({ type: "GET", contentType: "application/json;

How to return HTML from ASP.Net WebMethod call using Jquery?

百般思念 提交于 2019-12-04 20:54:07
Using Asp.Net 4.0 Web Forms and Jquery 1.6.2. I want to make an Ajax call to a WebMethod on a page and have it return html. On the server side the WebMethod looks like this. [WebMethod] public static string GetOrders() { return theMethodThatGeneratesHtml(); } and here is the calling Ajax function. function GetOrders() { $.ajax({ type: 'POST', contentType: "application/json", url: "Orders.aspx/GetOrders", data: "{}", success: function (data) { $('#content').html(data); }, dataType: "text" }); } The data that is returned from the WebMethod is always wrapped up as a json object that start like

Ajax call to Asp.net Web Method using Jquery

﹥>﹥吖頭↗ 提交于 2019-12-04 19:55:01
I am using a jquery method, to send information (namely only member identification #) from client side to the server side. The server side has the traditional Web Method implemented so as to capture data sent and execute SQL queries based on it. Web-service-method-using-jQuery However until now I have been returning a single string from the server side back to the client side after the SQL query. Wondering what would be the best way to return a complicated series of strings... member Identification number, start date, end date, type of member... depending on the type of the member, there can

JQuery AJAX post to asp.net webmethod never getting called

匆匆过客 提交于 2019-12-04 13:50:13
I have a web method in one of my aspx pages: [WebMethod] public static string AddDebt(int userId, int type, string description, float amount) And in the aspx page I have the JQuery $(".addDebt").click(function (e) { e.preventDefault(); var userId = $("[id$='txtUserId']").val(); var type = $("[id$='ddlExistingDebtType']").val(); var description = $("[id$='txtExistingDebtLender']").val(); var amount = $("[id$='txtExistingDebtAmount']").val(); var results = new Array(); results.push({ userId: userId }); results.push({ type: type }); results.push({ description: description }); results.push({

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

会有一股神秘感。 提交于 2019-12-04 12:32:38
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(); $("#<%=Button1.clientID %>").click(); $.ajax({ type: "POST", url: "Projects.aspx/btnSaveResource", data: JSON

Can we use same datatable for pagemethod and webmethod in ASP.NET?

旧城冷巷雨未停 提交于 2019-12-04 03:10:05
I am trying to create a new webpage where i need to display almost 10 different gridviews and charts. Gridviews are binded on pageload event and charts are displayed using jquery-ajax method (using amcharts as well as highcharts) by calling WebMethod. Initially i implemented the page in a way that after executing same set of stored procedures for gridviews(for showing grid view data) and webmethods(for drawing charts).So same sps are executed twice for this page(one for grid and another for chart).There are 10 sps required to execute for fetching the data. So for improving the page performance

Should I be using Web API vs Web Methods?

て烟熏妆下的殇ゞ 提交于 2019-12-04 03:01:25
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? 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. Whether you use WCF or the ASP.NET Web API will depend on your requirements. WCF is more similar to web methods,

ASP.NET 4 jquery ajax webmethod call

老子叫甜甜 提交于 2019-12-03 23:13:45
问题 In ASP.NET 3.5 I had this javascript on a page (default.aspx): function getMoreNewsItems() { $.ajax({ type: "POST", url: "default.aspx/LoadNewsItems", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { alert(msg.d); } }); } With this in the code behind (default.aspx.cs): [System.Web.Services.WebMethod] public static string LoadNewsItems() { return "test1"; } I have a ScriptManager on the page with EnablePageMethods=true. All worked fine.