webmethod

C# passing variables in System.web.services.WebMethod

Hi, I am rather rubbish when it comes to AJAX and javascript on general. I have a WebMethod: [System.Web.Services.WebMethod] public static string DumpClients() {} I have this code in a js file: mainScreen.DumpClients = function() { $('#runclientdumpbtn').attr("disabled", "true"); mainScreen.clientDiv.innerHTML = ""; $("#loadingim...

How to pass content of image file from fileupload control to web method via javascript?

Hello! I have a problem with using binary content of file. I want to pass web method content of file. I retriev it from fileupload control on my page via javascript function getAsBinary(). But error appears in web method, when I try to create example of class Image. So, I have the page (.aspx) with fileupload control and scriptmanager. T...

asp.net jquery datatables.net webmethod

I am using ASP.net 3.5. A call to a Webmethod using JQuery returns valid JSON data. However when I call the same webmethod to populate a html table using the datatables.net JQuery plugin, I get back the entire html of the page. **WebMethod:** <WebMethod()> _ Public Shared Function GetData() As String Dim a As String =...

ASMX webservice with Guid parameter

I've got an asmx web service with the following method [WebMethod] public string LoadRegions(Guid id) { throw new NotImplementedException(); } When I attempt to call this method, I receive this exception: System.InvalidOperationException: LoadRegions Web Service method name is not valid. at System.Web.Service...

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

Hello folks, 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 call. Your insight is appreciated! Call to js function the invokes the jquer...

Why is msg.d not supported in Mono 2.6.1?

Currently I have webservice running on the Mono platform. When I call the service I get the data in the form of msg, and not msg.d. Any thoughts? Update: Wow, this turns out to be a big deal. As Phil Haack explains, this opens up the possibility of an XSS attack when you use a GET to fetch the data. Question still stands: should t...

Read out result of a PageMethod into a jQuery-script

Hello, I am quite a jQuery novice and try to read out the result of a PageMethod into my jQuery script. I have a ScriptManager installed and the following WebMethod: [WebMethod(EnableSession = true)] public static string CheckSystemDefault(string _id) { int id = Convert.ToInt16(_id); addressTypeRepository = new A...

ASP.NET Web Service

Why doesn't a ASP.NET web method allow default parameters ? ...

Can I have Object type as a parameter of @WebMethod?

I've tried to create a web method which has parameter of java.lang.Object but I receive error similar to: http://community.jboss.org/message/532500 One guy answered to this saying that: "You can pass only JAXB supported types web method parameters. java.lang.Object cannot be passed as web method parameter." And indeed, when I changed ...

How can i call [WebMethod] which is defined in user control ?

I am working in asp.net using C# and I have a [WebMethod] defined in User Control. I dont want to use web service. My Question is : How can i call this any method which has [WebMethod] attribute? I want to call it from jQuery (Ajax) request. Please help me ...

Combine Webmethod and CustomValidator

I want to use ajax with validator control. for example, the various error messages should be show when a user input his/her name in a textbox to register: if nothing is input, "you should input your name"; if not correct format, "your username is not valid formatted"; if the username has used by other user, "the usename has been used ...

Does asp.net webmethod always return jsonified data?

hi, I have general question that if an asp.net webmethod always returns data in 'json' form.If not what is the default return datatype of a webmethod? I am wondering if there is a way I can get the data from a webmethod in 'HTML' rather than 'json'? Thanks ...

how to export a dataset to excel and raise a file download dialog from asp.net webmethod?

Hi all, I am using the following code to export a datset to excel sheet. [WebMethod] public static void ExporttoExcel() { DataSet ds; productfactory pf=new productfactory(); ds = pf.getproducts(); HttpResponse response = HttpContext.Current.Response; // first let's clean up the response.o...

why does the 'error' function of $.ajax execute even when the request to invoke a webmethod succeeds?

hi, I am using jquery ajax method to invoke a webmethod upon clicking a 'span'.This is webmethod is in one of my aspx pages and I am invoking it from the master page using the following code. $(document).ready(function(){ $("#btn").click(function() { $.ajax({ type: "POST", url: "Default.aspx...

Access raw JSON from inside asp.net WebMethod

I have a System.Web.Services.WebService containing several WebMethods. If any of these WebMethods raises an exception, I want to log the values passed to that WebMethod. I want to handle this in a way that is generic enough that I can use the same method regardless of the number or type of parameters. I thought I would log the raw JSO...

Making a class a full fledged webservice.

I am not using Visual Studio 2010. I have a class file that I marked as a webmethod. I am able to compile it using C# compiler targetting the .NET 3.5 framework. How can I make this a webservice? Any ideas? ...

how to send a collection and a few other values in Json form to a webmethod?

Hi All, Upon clicking a button I need to send a collection and a few other variables to server in Json form.For each value in the collection the server code (C# ) wil update those other variables in the DB. For example there is a ‘classnumber’ collection with values (First, Second, Third, ….),other variables (‘teacher_name’ and ‘subjec...

JQuery Ajax with multiple return values from ASP.NET

Hi, How can I return multiple values from JQuery.Ajax() in the success function ? I tried it: $.ajax({ type: "POST", url: "default.aspx/myFunction", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", suc...

Embeding web service method to the .ascx(user control)

It didn't work and i think it won't but i wanted to ask you(last chance). I have a simple ascx file. It has one select element which retrieves sub categories when it is selected (over web service). I want to write my web method in ascx.cs file instead of to write in other asmx file. ASCX.CS file protected void public Page_Load(....){...