asmx

Where am I going wrong in calling ASMX web methods from jquery?

两盒软妹~` 提交于 2019-12-04 20:37:55
I have a simple webmethod on an asp.net 2.0 application (using the 1.0 extensions not the 3.5 ajax extensions). I'm attempting to call the method from jQuery and when I do it as the countless examples show on the Internet and here on SO, I get an Internal Server Error message returned. Here's my current code: [WebMethod] [ScriptMethod(ResponseFormat=ResponseFormat.Json)] public string Select(string login) { UserProfile profile = UserProfile.GetUserProfile(login); return "{ FirstName: '" + profile.FirstName + "', " + "LastName: '" + profile.LastName + "', " + "EmailAddress: '" + profile

Limiting number of calls to an ASMX Web Service

…衆ロ難τιáo~ 提交于 2019-12-04 19:06:19
We have an asmx web service hosted in IIS6. Is there a good way to limit the number of calls to the service in a period of time for a single IP? We don't want to put a hard limit (X number of times an hour), but we want to be able to prevent a spike from a single user. We're currently investigating to see if our firewall is capable of limiting connection attempts. In the case that our firewall is not able to limit connections, is there a good way to handle this programmatically? Rather than trying to come up with our own custom solution and reinventing the wheel, is there an existing

What to choose? ASMX web service or WCF in .net 3.5?

拥有回忆 提交于 2019-12-04 17:35:39
问题 The current project i am working on is extensively using web services and is made in .net 3.5. Now as we are going for implementation of second phase we are confused if we should either use WCF or web service as done previously ? Further is there anything new that can be useful and is coming up with .net 4.0 regarding web services or WCF. 回答1: We just finished a brand new project using WCF instead of ASMX Web Services for the first time. We are VERY happy with the results, but do know that

WebMethod response format

喜欢而已 提交于 2019-12-04 14:40:00
I recently saw a jQuery example where a POST was made to "Default.aspx/Test", where Test was a WebMethod in Default.aspx, and the content-type for the request was "application/json". The reply from the WebMethod was in JSON. I always thought WebMethods returned SOAP responses, but if I'm interpreting this code correctly, like I said, the WebMethod returns JSON. Is this correct? Do WebMethods return a response in the format of the request content-type? Since when has this been possible? Always? Or is this because I have ASP.NET AJAX installed? If so, what namespaces can I disassemble to see how

How to Bind jqGrid with asmx webservice C#

為{幸葍}努か 提交于 2019-12-04 14:20:58
Please i need some help in how to bind jqGrid with asmx webservice C# , i found some topics in how to convert asmx webservice to JSON but it's not clear with me Regards Oleg First of all you should define WebMethod which will provide the data for the jqGrid. If you plan to implement server side sorting and paging the webmethod should have at least the following parameters public JqGridData TestMethod (int page, int rows, string sidx, string sord) where JqGridData class will be defined for example like public class TableRow { public int id { get; set; } public List<string> cell { get; set; } }

ASMX file download

依然范特西╮ 提交于 2019-12-04 11:42:34
I have an ASMX(no WCF) webservice with a method that responses a file that looks like: [WebMethod] public void GetFile(string filename) { var response = Context.Response; response.ContentType = "application/octet-stream"; response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName); using (FileStream fs = new FileStream(Path.Combine(HttpContext.Current.Server.MapPath("~/"), fileName), FileMode.Open)) { Byte[] buffer = new Byte[256]; Int32 readed = 0; while ((readed = fs.Read(buffer, 0, buffer.Length)) > 0) { response.OutputStream.Write(buffer, 0, readed); response.Flush();

Asmx web service returning xml instead of json, Trying to remove <string xmlns=“http://tempuri.org/”> from service output

百般思念 提交于 2019-12-04 10:59:15
问题 I have been looking for 100's of links for last 3 hours eg adding scriptfactory to webconfig, 3 mistakes, setting content type etc. I am not able to figure out what actually the mistake is. Environment: Service running on .net 4.0 Web application running on .net 4.0 Requirements: I need to bind a jqGrid with asmx web service that is returning me a json as a string. Web service file contains following code. [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo =

ASP.NET Web Service changes port on Invoke

陌路散爱 提交于 2019-12-04 09:26:50
I have a ASP.NET Web Service on IIS, that is working on port 8080. On port 80 I have Apache, that is redirecting some web sites to IIS. On this case, I can access the Web Service page ( http://example.com/service/ ), which gives me all the methods available. However, when I try to invoke a method, it goes to a web page like this one: http://example.com:8080/service/Service1.asmx/Method . Of course that a public access can not see any result, the port 8080 is blocked and can not be opened. Internally, the Web Service works on port 8080, but the public request need to be done to the port 80.

How do I include my own wsdl in my web service in C#

扶醉桌前 提交于 2019-12-04 07:54:06
I have a .wsdl file that my web service (old asmx style) must implement. That is taken care of. When I publish the web service you can call it with ?wsdl parameter to get a generated wsdl. How do I include my .wsdl file so that is the one that is returned instead of the generated one? Is it possible to do with an attribute in my web service class? Is it a given to stay with "old-style" ASMX? Or could you move up to WCF? That's really the most current webservice offering by Microsoft, and if you're doing something new and you're on .NET 3.0 or higher - why spend time on "old" technology? In WCF

How to Return Errors from an ASMX Web Service?

隐身守侯 提交于 2019-12-04 07:36:16
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> CraigTP Yes, this is possible. What you'll need to look into is the SoapException class , and specifically the Detail property of the SoapException class. The SoapException class