asmx

Call non-static method in server-side from client-side using JavsScript

☆樱花仙子☆ 提交于 2020-02-09 01:08:45
问题 How do I call a non-static method in server side(aspx.cs) from client side using javascript (aspx)....? As far as I know I can call static method in server side from client side... server side: [WebMethod] public static void method1() { } client side: <script language="JavaScript"> function keyUP() { PageMethods.method1(); } </script> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"> </asp:ScriptManager> It works. Now how do I call non-static method from client

what is the right way to spawn thread for database IO in asmx web service?

风流意气都作罢 提交于 2020-01-30 09:17:41
问题 I have a short lock guarded section in a method (that serves the request entirely) that makes all initializations (etc. log-related). So only 1 thread can be there at time. In this section I also load system data from database if not loaded. This is naturally executed only on 1st request and it does not matter it takes time and no threads can propagate since it's done only once (by dummy request). static public void LoadAllSystemData() { SystemData newData = new SystemData(); //own type (etc.

Examples of practical usage of JSON to and from an ASMX web service via jQuery

半腔热情 提交于 2020-01-25 09:05:13
问题 Can anyone recommend an article on sending and receiving JSON to an asp.net web service (any flavor) that uses more practical examples than "hello world". Ideally, something that covers topics like: Receive a single complex object from a web service (to display in a form) Receive a collection of complex objects from a web service (to display in a table) Send a single complex object to a web service (for updating the database) Send a collection of complex objects to a web service (for updating

Enable PUT, DELETE verbs with .asmx

喜你入骨 提交于 2020-01-24 12:13:07
问题 I'm trying to make my webservice(.asmx) to be able to respond to PUT and DELETE methods, but it always returns a 404 error. I managed to get it to respond to GET method, by adding the following to my web.config: <system.web> <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices> </system.web> Now, what is it that I have to do in order to get it to respond to PUT and DELETE methods? I've already tried adding things like the code below(and lots of

What is eating my cookie?! Cookie does not get transferred in asmx call

萝らか妹 提交于 2020-01-24 05:38:17
问题 I'm having a (browser) cookie issue here. I have a Sharepoint page (http://myServer:24628/sites/myApp/myDocumentLibrary/test.aspx). When the page is requested, I can see in the request headers (using firebug) that there's a ASP.NET_SessionId cookie. Request headers: Host: myServer:24628 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,

ASP.Net web service won't return JSON - Always XML

╄→гoц情女王★ 提交于 2020-01-23 13:22:32
问题 I'm trying to create a simple AJAX & web service test (using C# .Net 2.0) to return data in JSON format, and I have (I believe) everything I need but I keep running into the same problem over and over again. The response from the web service is always XML. (It always has <?xml version="1.0" encoding="utf-8"?> as the 1st line). I've tried the various options that come within the ScriptMethod tag, but nothing makes any difference. The call works okay, but I get a "parsererror" with the response

How to Return Errors from an ASMX Web Service?

本小妞迷上赌 提交于 2020-01-22 20:11:46
问题 My web service method returns a collection object, this will serialize nicely, thanks to the way C# web services work! But if my code throws an uncaught exception, I want to instead return a custom error object. Is this possible using C# ASP.NET v2? For example, Normal Operation should return: <Books> <book>Sample</book> <book>Sample</book> </Books> But on error I want <error> <errorMessage></errorMessage> </error> 回答1: Yes, this is possible. What you'll need to look into is the SoapException

How to generate a WSDL file from a C# webservice

旧时模样 提交于 2020-01-22 05:45:25
问题 I've created a WebService like this: [WebService(Namespace = "http://ns")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class GroupManagerService : WebService { public GroupManagerService() { } [WebMethod] public bool MyMethod(string loginname, string country) { // code here... } } Is it possible to generate a WSDL file for this code without connecting to a running service? I searched and I found information about SvcUtil.exe & wsdl.exe , but these work only when

Why we cant return List<T> in ASMX web services?

我们两清 提交于 2020-01-21 05:22:11
问题 As developers know we cant return List<T> with web services, we can only return lists with converting them to .ToArray(); I've searched some, but cant get effective answer about Why we cant retun List with web services. Why we must convert them ToArray(); ? 回答1: Web services are supposed to be interoperable with many languages. Nearly all languages have arrays, but only .NET has the specific implementation of List<T> that you're using. 回答2: There is nothing whatsoever preventing you from

How to call a .NET web service from Blackberry Simulator?

谁说胖子不能爱 提交于 2020-01-20 04:16:06
问题 I have to call a .NET web service (http://192.168.1.14/CG/authentication.asmx) from the Blackberry Simulator. Already i have done it in Android with KSOAP2, but i have no idea about how to do this in Blackberry. Can i use KSOAP2 in Blackberry? If i can please give some code snippets. Also please tell if you know any other ways to do this. 回答1: I've not used KSOAP2 before but I know that you can use it for Blackberry. To call web services I use the Sun Java Wireless Toolkit (WTK) to generate