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
0
votes
2 answers

ASP.NET WebMethod that works both with and without a Session

I am making a ASP.NET web page in C#. I'm finding that if the web page is left alone for a short period of time, I start getting 401 Unauthorized Errors whenever the page attempts to call a WebMethod. I think this is probably caused by the Session…
0
votes
1 answer

WebMethod - JSON Serialization Error

I am making a jQuery AJAX call to a back-end WebMethod in an aspx.cs page. I am getting an error in the .NET JSON serialization. As such, I am looking for ways to either fix the error or avoid using JSON (the only return format for…
0
votes
1 answer

JSON to c# webmethod using jQuery, passing datatable

I already have some webmethods receiving 1 or 2 parameters working successfully. What I want to do is sent a json string that can be deserialized into a datatable with multiple rows. The string looks similar to this:…
Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70
0
votes
3 answers

Sitecore, jQuery ajax, and WebMethod returns the page itself

I am trying to use jQuery ajax to call a WebMethod on an aspx page that I have in my application. I am following this article: http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/ I noticed that when I try to make the ajax…
user1496624
  • 107
  • 1
  • 2
  • 12
0
votes
1 answer

How to findout the server controls in webmethod using asp.net?

I have written my webmethod in aspx.cs file , but when i call n.Nautilus() method in same page , i am unable to get the server side controls in Nautilus(), in this method controls becoming NULL , please find the reasons and solution to this problem…
hmk
  • 969
  • 10
  • 38
  • 70
0
votes
2 answers

Highcharts Series from AJAX

I have a problem with Json formating returned from .ASMX I need to return something like this [{ name : "TEST1", data : [100]}, { name : "TEST2", data : [200]}] so here's my sample [WebMethod] [ScriptMethod(ResponseFormat =…
Leary
  • 117
  • 1
  • 3
  • 10
0
votes
1 answer

using jQuery to call webMethod returns HTML... webMethod not called at all

I'm using VisualStudio 2008 and have a method on an ASPX page I am trying to call with javascript using jQuery as shown below. I am just getting the page's HTML back. The webmethod is not called. Interestingly, if I change the name of the webMethod…
Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70
0
votes
1 answer

How to access Code Behind Functions in a WebMethod?

Possible Duplicate: Accessing code behind functions from WebMethod I have following WebMethod, which i'm calling through Json. Its working fine. [System.Web.Services.WebMethod] public static string CheckUserName(string userName) { string…
user1321748
0
votes
2 answers

Web Method is not executed in safari($.ajax callback)

I have following code. ASPX Page Set Price JS Code function CallJQuery() { var prc = document.getElementById('<%= hdnPrice.ClientID %>'); var…
ravidev
  • 2,708
  • 6
  • 26
  • 42
0
votes
2 answers

How to ensure jquery/Ajax calls to webmethods or mvc controllers are authorised?

How can I ensure that information isn't returned from a webmethod or mvc action by just anyone calling it from Jquery/Ajax call/HTTP post get (you get the idea). Previously I would have used session variables or the view state to do this on every…
user1266921
  • 225
  • 3
  • 14
0
votes
1 answer

"Unknown web method" if ASPX WebMethod function name is altered. Dynamic compilation issue?

I have a standalone .ASPX page (no code behind) which holds a simple WebMethod that I'm calling via JQuery Ajax. See below: (Please be aware this is proof-of-concept code, not production code!) <%@ Page Language="C#" %> <%@ Import…
chrsmrrtt
  • 197
  • 3
  • 14
0
votes
2 answers

Sending notifications client

I want to send a notification (say a string) to subscribers(subscribers ip addresses are in a database on the server side) by calling another method. when ever I call that method the output becomes error-some. [WebMethod] public string…
diyoda_
  • 5,274
  • 8
  • 57
  • 89
0
votes
1 answer

Using CreateControlCollection() from within a WebMethod

my code calls a WebMethod. Within that WebMethod I have the need to create a new control collection. In VB I would normally write: Dim cc As System.Web.UI.ControlCollection = CreateControlCollection() But because I'm inside a WebMethod, I get…
wotney
  • 1,039
  • 3
  • 21
  • 34
0
votes
1 answer

How Do i pass a file into a web method?

I would like to pass a file into a [Webmethod] and once its inside, send it as an email attachment. How would i go about doing this? I'm unsure where to start? FileUpload1.PostedFile.FileName and FileUpload1.FileContent are the 2 things i want to…
Pomster
  • 14,567
  • 55
  • 128
  • 204
0
votes
1 answer

How to Use a Web Service to Update TextBox controls in ASP.NET?

I have a web form where I need to add, update, delete and read using a unique ID. So far I have managed to add, update and delete functions with little trouble. However now I am having trouble getting my read function to work (understand I have a…
user1363687
  • 3
  • 1
  • 3