Questions tagged [webmethod]

WebMethod is an attribute that is marked to indicate that a function (usually in .NET) in a web service is exposed to the consumers of the web service.

The WebMethod attribute is attached to a public method (cannot be attached to a private/protected) that you want the method exposed as part of the .NET Web service. It is also used to further configure the behavior of the method by passing additional attributes. Check out the MSDN link for more information, How to: Use the WebMethod Attribute.

1317 questions
11
votes
1 answer

Can I Set the HTTP Response Code & Throw an Exception on an ASMX JSON Service?

In an ASP.NET ASMX WebMethod that responds JSON, can i both throw an exception & set the HTTP response code? I thought if i threw an HttpException, the status code would be set appropriately, but it cannot get the service to respond with anything…
Markus
  • 518
  • 6
  • 18
11
votes
1 answer

Return large string from ajax call using Jquery to Web Method of ASP.NET

Inside my ASP.NET website I am calling a Web Method using Jquery as follows: $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", data: "{'param1': '" + param1 + "','param2': '" + param2+ "' }", dataType: 'json', …
user1808827
  • 345
  • 2
  • 5
  • 11
10
votes
4 answers

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

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…
AcAnanth
  • 765
  • 3
  • 19
  • 53
10
votes
2 answers

Launching aspx SOAP services project in Visual Studio 2013 Causes StackOverflowException

This is a C# web services project in Visual Studio that has existed for a number of years. Today it started throwing an exception upon startup within Visual Studio, but only when the debugger is attached. The exception…
redcalx
  • 8,177
  • 4
  • 56
  • 105
10
votes
1 answer

Should I be using Web API vs Web Methods?

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?
TreK
  • 1,144
  • 2
  • 13
  • 25
10
votes
3 answers

How to download file via jQuery ajax and C#

I want to download a file using jQuery Ajax web method, but it's not working. Here is my jQuery ajax call to web method: function GenerateExcel() { var ResultTable =…
rahul
  • 7,573
  • 7
  • 39
  • 53
10
votes
3 answers

Calling webmethod ina aspx.cs file using jquery ajax

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) { …
Luke Villanueva
  • 2,030
  • 8
  • 44
  • 94
10
votes
1 answer

Calling a page's webmethod from javascript on a different page

Is it possible to call a method attributed with [WebMethod] from javascript on a different page? I.e. using the following jquery ajax call from script on a page called PageTwo.aspx: $.ajax( { type: "POST", url:…
hofnarwillie
  • 3,563
  • 10
  • 49
  • 73
9
votes
1 answer

Ajax data source (objects) :TypeError: f is undefined

I am working on my ASP.Net web application where I have to populate an HTML table with Ajax data source for which I am making a use of jQuery DataTables plugin. HTML code:
umer
  • 1,196
  • 1
  • 14
  • 33
8
votes
3 answers

using web methods with master pages

I've got a function on all pages in my site which is located in my master page and I want it to run from some jQuery Ajax method. I've got some code like this at the moment jQuery $(document).ready(function() { $("#test").click(function() { …
Jamie Taylor
  • 3,500
  • 21
  • 65
  • 99
8
votes
1 answer

jqPlot Stacked Bar Chart rendered off-chart

I'm using jqPlot to generate a stacked bar chart based on data from a web method. The chart renders successfully, but is blank. When I set the pointLabels to 'true', they appear in a jumble to the left of the chart. I'm guessing the stacked bars…
ks78
  • 927
  • 2
  • 17
  • 34
8
votes
1 answer

Get Request Parameters from XML using WebFilter

I´m developing a Web Service, using Glassfish, using SOAP. I have several web methods, and I want to get introduce my webmethod name and his parameters to http head request. For example: I have this path: context: WebServices webMethod:…
Goldbones
  • 1,407
  • 3
  • 21
  • 55
8
votes
3 answers

Getting "401 Unauthorized" error consistently with jquery call to webmethod

I have been struggling to get my jquery call to a webmethod to work. I am being bounced by the server with a "401 Unauthorized" response. I must have an incorrect setting in the web.config or somewhere else that would be preventing a successful…
8
votes
2 answers

What is the advantage of using web API over web method in ASP.NET

I am familiar with web method. Now I got a suggestion to use web API instead of web method. I had done a demo of ASP.NET web API it's more closer to a MVC architecture am using the classical asp.net web development. I don't like to mess up the…
8
votes
1 answer

Is it possible to use async/await in webmethod asmx service

I am trying to figured it out, but have no success for now. Is it possible to use async/await in webmethod asmx service ? What I found till now is that async/await can be used only in WCF service method (rest or whatever).
Nikola Yankov
  • 1,264
  • 1
  • 15
  • 28
1
2
3
87 88