webmethod

The length of the string exceeds the value set on the maxJsonLength property

无人久伴 提交于 2019-11-27 13:57:13
I am loading tab content data through jQuery's ajax post method via web method with around 200-300 records. And getting following error in the console: Error: Sys.Net.WebServiceFailedException: Sys.Net.WebServiceFailedException: System.InvalidOperationException-- Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. Changing the length of the maxJsonLength attribute in Web.config like this does not help. <configuration> <system.web.extensions> <scripting> <webServices> <jsonSerialization

Calling a WebMethod using jQueryAjax “GET”

萝らか妹 提交于 2019-11-27 12:59:10
问题 i have a ajax request which works well using "POST" but when used "GET" it gives me the following error, {"Message":"An attempt was made to call the method \u0027GetSomething\u0027 using a GET request, which is not allowed.","StackTrace":" at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System

Pass a user defined object to ASP.NET Webmethod from jQuery, using JSON

泪湿孤枕 提交于 2019-11-27 07:41:46
I am trying to pass in some simple JSON to an ASP.NET 4.5 Webmethod from jQuery. And it is not working quite the way I want it. It works if I accept the inputs as separate parameters: [WebMethod] public static Address GetJSonAddress(string name, string street) But if I try to take it as an object it does not work, what gets passed in is simply null: [WebMethod] public static Address GetJSonAddress(Address newAddress) I have tried Webmethods, Pagemethods, WCF using DataContractJsonSerializer...nothing. The Address class is decorated appropriately with Datamember/DataContract. The properties are

JQGrid - Cannot call ASP.NET WebMethod but can with Ajax

依然范特西╮ 提交于 2019-11-27 03:36:45
问题 I am new to jqGrid and I have found it difficult to follow the documentation jqGrid Documentation I cannot figure out how to call a WebMethod when setting up the JQGrid. I have been successful in making an Ajax call to get the data and then setting up the JQGrid with local data. I think its an extra step in the setup process and that I should be able to provide the path to the webmethod using the url property. The editurl property is the same way. I am never actually receiving the post to the

asp.net call WebMethod from Javascript asyncronous

半腔热情 提交于 2019-11-26 23:25:32
问题 I am trying to build an asp.net(c#) page that updates some state texts every second. Now I have implemented an button that calls another PageMethod which restarts something and takes a little while. The problem is, that when I call the restart PageMethod , the update PageMethod can't update as long as the restart method is proceeding... I wrote a little example to show what I mean: WebMethods in my Page: [WebMethod] public static string Update() { //return "a" to see when the Update

How to call webmethod in Asp.net C#

匆匆过客 提交于 2019-11-26 23:03:55
问题 I want to call a web method in asp.net c# application using the following code Jquery: jQuery.ajax({ url: 'AddToCart.aspx/AddTo_Cart', type: "POST", data: "{'quantity' : " + total_qty + ",'itemId':" + itemId + "}", contentType: "application/json; charset=utf-8", dataType: "json", beforeSend: function () { alert("Start!!! "); }, success: function (data) { alert("a"); }, failure: function (msg) { alert("Sorry!!! "); } }); C# Code: [System.Web.Services.WebMethod] public static string AddTo_Cart

Authentication failed during call webmethod from jquery.ajx with AspNet.FriendlyUrls and AspNet.Identity

不想你离开。 提交于 2019-11-26 22:25:28
问题 If I call webmethod from jQuery.Ajax with installed Nuget packages Microsoft.AspNet.FriendlyUrls v 1.0.2 and Microsoft.AspNet.Identity v.1.0.0., then I get the data object, but without data.d but with property Message 'Authentication failed'. My Webmethod.aspx is: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>WebMethod</title> <script src="Scripts/jquery-2.0.3.js"></script> </head>

jQuery AJAX call to an ASP.NET WebMethod

会有一股神秘感。 提交于 2019-11-26 20:59:41
I have the following jQuery AJAX request: function sendUpdate(urlToSend) { var code = AccessCode; var url = urlToSend; var options = { error: function(msg) { alert(msg.d); }, type: "POST", url: "webmethods.aspx/UpdatePage", data: "{ accessCode: " + code + ", newURL: '" + url + "' }", contentType: "application/json; charset=utf-8", dataType: "json", async: true, success: function(response) { var results = response.d; } }; $.ajax(options); } And the corresponding ASP.NET WebMethod: [WebMethod] public static bool UpdatePage(string accessCode, string newURL) { bool result = true; try { HttpContext

Calling webmethod ina aspx.cs file using jquery ajax

房东的猫 提交于 2019-11-26 18:31:37
问题 I have a default.aspx.cs which contains my webmethod to call and I have my js file that containg my jquery ajax. I can't get to call the webmethod. Here is my default.aspx.cs: protected void Page_Load(object sender, EventArgs e) { string[] MyArray = new string[1]; MyArray[0] = "My Value"; Grid1D.DataSource = MyArray; Grid1D.DataBind(); } [WebMethod] public Details[] getDetails(string columnname, string inputVal) { List<Details> list = new List<Details>(); DbAccess dbacc = new DbAccess();

Trying to make Web Method Asynchronous

不羁的心 提交于 2019-11-26 16:48:32
The project I am currently working on involves MS SQL Server and ASP.net Web Services that use Session variables. Apparently this causes a client's calls to execute in a sequential manner. I want to make sure that these methods execute asynchronously. After doing some research it appears to me the choicest method is to persist the session state in the database using a table that tracks sessions ( using guids say ) and separate tables for each session. Before I dive directly into this I need to know if I can gain the same sense of asynchronous operations for the web service if I configure SQL