webmethods

ASP .NET: Cannot call Page WebMethod using jQuery

I created a WebMethod in the code-behind file of my page as such: [System.Web.Services.WebMethod()] public static string Test() { return "TEST"; } I created the following HTML page to test it out: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"/&gt;&lt;/script...

Webmethod not working when webservice published on other server - same data gives "Object Reference Not Set to an Instance of an Object"

Could it be a difference in .Net setup on server? Both have .Net 3.5 SP1 I can see both webmethods when I use url with .asmx name. Failing on Invoke... public int ReferLead(DataTransferObjects.ClientTransferObject request, List<DataTransferObjects.ClientDebtTransferObject> debtrequest) { object[] results = this.Invoke("Re...

How do I avoid web method parameters using proxy classes?

I have a serializable POCO called DataUnification.ClientData.ClientInfo in a .NET class library project A. It's used in a parameter for a web service defined in project B: public XmlDocument CreateNewClient(ClientInfo ci, string system) I now wish to call this web method from project C and use the original DataUnification.ClientData....

Programmatically call webmethods in C#

I'm trying to write a function that can call a webmethod from a webserive given the method's name and URL of the webservice. I've found some code on a blog that does this just fine except for one detail. It requires that the request XML be provided as well. The goal here is to get the request XML template from the webservice itself. I'm ...

ASP.NET WebMethod Returns JSON wrapped in quotes

Hi, I have an asp.net page with a WebMethod on it to pass JSON back to my javascript. Bellow is the web method: [WebMethod] public static string getData(Dictionary<string, string> d) { string response = "{ \"firstname\": \"John\", \"lastname\": \"Smith\" }"; return response; } When this is returned to the client it is for...

ASP.NET Client to Server communication

Can you help me make sense of all the different ways to communicate from browser to client in ASP.NET? I have made this a community wiki so feel free to edit my post to improve it. Specifically, I'm trying to understand in which scenario to use each one by listing how each works. I'm a little fuzzy on UpdatePanel vs CallBack (with Vie...

Invoking WebMethods with XmlHttpRequest and Pure JavaScript

I have what should be a relatively simple task that's frankly got me stumped. I've researched it until my brain is fried, and now I'm punting, and asking you guys for help. Here's the scenario: I have an ASPX page (Q2.aspx) that is decorated with the WebService, WebServiceBinding, and ScriptService attributes. That page contains a ...

How Can I return a rendered asp.NET panel control content from server-side as a result of jQuery.ajax()?

Hi, At first, I should confess that I am not sure if it is a good practice or not. I have came out with the idea due to my practice of jQuery.ajax(). What I want to achieve is depended on this design: //Server Side; an .asmx file contains a method like this: [WebMethod] public string NewContent(string parameter) { string renderedHTML...

Redirect a new page from server

Hi, i have this webmethod that redirects to a new page from server, [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Xml)] public static Boolean realizaConsulta(Dictionary<string, string> datos) { System.Web.HttpContext.Current.Response.Redirect("PRepConsulta.aspx", false); } but i got this error: Microsoft JScript runti...

Is there any way to have a [System.Web.Services.WebMethod] method in a standard page in c#?

Is there any way to have a [System.Web.Services.WebMethod] method in a standard page in c#? I have a c# ASPX page that I would like to have a a method for my ajax to call. I want everything to be self contained in a single file for organization and deployment purposes. When I add that directive to a System.Web.UI.Page for example: [Sy...

ASP.NET web services using reference parameters in webmethod

I have an issue when I try to retrieve info through a webmethod. I am using a proxy to call a web service, in that proxy I have an operation which returns data using 'out' parameters. The server executes the operation succesfully, giving back the parameters properly instanced (I also have checked the soap return message using a traffic...

Deprecating ASP.NET Web Methods

I have some internal-facing ASP.NET web services that have had numerous API additions over the years. Some of the original web methods, while still available for consumption, have recommended replacements available. I would like to steer consuming clients toward using these new methods so I can retire and eventually remove their elders...

How Can I Actually Use The JQuery Validation Remote Validation in ASP.NET Web Forms

I have searched everywhere, and I can't seem to find a solid example. Is anyone doing this? Can anyone provide and example of calling a remote validation using the JQuery validation plugin through a WebMethod in an aspx page (Web Forms)? ...

page method multiple call backs

Hi all, im calling page method on mouse over of image slider to show image from database. The problem is i'm getting multiple call backs. So does any one have idea on resolving this issue. Thanks, Mehul Makwana. Code which i'm using for page method. var contextArray = "img"; pageMethodConcept = { callServerSideMethod: fun...

consuming asmx web service using ajax/jquery in ASP.NET?

HI I am trying to save data using web services-jquery and json, from some example on the web I wrote a similar code but a String instead of int: //----------------------------------------- <div id="dialogL" title="Create a new Layer"> <p>Enter Name:</p> <input id="txtValue1" type="text" size="40" /> <p>Enter Description:</...

ASP.NET WebService how to make a struct be treated as a primitive type for WSDL and serialization

This isssue may have several aspects so please read through first. Suppose that you have a stuct with a few small ints that pack well into Int64 and while you want to use your struct as a type in C# you want it to be exposed as In64 via web methods - so that WSDL has it and you retain basic REST ability (simple types make GET invocation...

JQuery AJAX post to asp.net webmethod never getting called

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$='...

Signaling web page when ThreadPool thread is completed

From a web page I start a time consuming job and update it's status on the UI using webmethod. Job is done in a thread: ThreadPool.QueueUserWorkItem(new WaitCallback(DoJob), parameters); Job set's it status using static properties, and when web page, using javascript, calls web method it read those properties. [System.Web.Services...

Can I return a struct from a WebMethod

I have a struct called Base64String which basically does implicit conversion between a string and a byte[] It's working quite well in the library, but here's the oddity... When I have a webservice, that returns the value as Base64String [WebMethod] public Base64String GetBase64String(string input) { return input; ...

WebMethod and IEnumerable

I need to create WebMethod that will get some data from db and return that to the client. Now, assume that the amount of data is huge, so I'd like to take and return data in parts. is there any way to use yield return in Webmethod? as I know there is no way to return generic types in WebMethods but I couldn't use non-generic IEnumer...