asmx

Preventing serialization of properties in VB.NET

风流意气都作罢 提交于 2019-12-07 04:53:10
问题 I have a VB.NET class which I'm serializing via XML in an asmx file. I've added attributes to the datamember I want to ignore in serialization, but it's still returned. I also have the <DataContract()> attribute on my class and the DataMember attribute on all properties which should be serialized. My property declaration is: <ScriptIgnore()> _ <IgnoreDataMember()> _ Public Property Address() As SomeObject 回答1: By adding an attribute to the backing field and converting it from an auto-property

Is there a better way of customizing SOAP headers in C#

风流意气都作罢 提交于 2019-12-07 00:46:26
In the past I have needed to create custom SOAP headers in a C# project that was using an imported WSDL web reference. I found a way to do it but I was never happy with it and I have sense wondered if there was a better way. What I did was create a header that derives from SoapHeader: [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://model.test.net")] [System.Xml.Serialization.XmlRootAttribute("securitytoken", Namespace = "http://model.test.net", IsNullable = false)] public class SpecialHeader : SoapHeader { [System.Xml.Serialization.XmlTextAttribute()] public string aheadervalue;

How to configure ASMX web service URL from remote source

独自空忆成欢 提交于 2019-12-06 17:39:16
We are working on a legacy C# enterprise app. Its client uses several web services, whose URLs, among lots of other settings, are read from the local app.config file. We want to migrate these settings into a global DB to simplify their management. However, I can't figure out how (and whether) it is possible to migrate the web service URLs. These are read from the service client code generated by VS and I can't seem to find a way to tell VS to use a different settings provider than the one generated into Settings.Designer.cs . We can overwrite the service facade's Url property with the value we

Get xhr object in vb.net while ajax calling fails

筅森魡賤 提交于 2019-12-06 16:25:31
I have a big problem in jQuery.ajax call. I am calling the web service whenever click the update button. I have a separate web service class, in which consist of few methods. When I calling the web service method, I have made the error handling and log the error information in db after that I have to override the “ex” that means error object to XMLHttpRequest . Is it possible to assign the SqlException to ajax object ( xhr ) in VB.NET ? Please help me its much more useful for me. Yes it is possible! I try to describe it in VB.NET (mostly I use C#, but I hope I'll not made syntax errors). Let

Asp.net Core and create a webservice (asmx) [duplicate]

ⅰ亾dé卋堺 提交于 2019-12-06 16:00:25
问题 This question already has answers here : Does ASP.Net Core 1.0 support WebForm projects (2 answers) Closed 3 years ago . With previous version of .net, I used right click on project , add file and then I can create a file name "Web Service(asmx)" and then I create my webservice and differents function needed. But I don't understand how on a new projet .net core, I create the same files to my project? thank you in advance for your help 回答1: In Asp.net Core there are no separate Web Api's or

asmx web service authorization

人盡茶涼 提交于 2019-12-06 15:19:58
I have asmx web service(c#). I'm using Windows Authentication to access web service. Now i need to provide some of web service methods only for speciefic user, for example Test. I cant find examples of such Authorization. Some examples of code would be appreciated. I don't think that web service have such restriction per memeber. Probably you will need to check the user rights inside of the web service members [WebMethod] public void HelloWorld() { if (this.DoesUserHaveRights(HttpContext.Current.User)) { // do the work here } else throw new AuthenticationException(); } or somethign like this

asp.net jqGrid dropdown multiselect

情到浓时终转凉″ 提交于 2019-12-06 15:04:56
i'm trying to use jQuery multiselect plugin in a form editing jqGrid (add form). This is the code ( colModel extract) I'm using to build the dropdown: { name: 'CaratteristicheCamera', index: 'CaratteristicheCamera', width: 50, hidden: true, edittype: 'select', editable: true, editrules: { edithidden: true, required: true }, editoptions: { multiselect: true, dataUrl: '<%# ResolveUrl("~/Service/Domain/ServiceRoom.asmx/GetRoomFeatureList") %>', buildSelect: function (data) { var retValue = $.parseJSON(data); var response = $.parseJSON(retValue.d); var s = '<select id="CaratteristicheCamera" name=

Limiting number of calls to an ASMX Web Service

旧街凉风 提交于 2019-12-06 14:44:02
问题 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

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

前提是你 提交于 2019-12-06 13:53:15
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, which I would expect as it's not valid JSON. I can call the web service method within the browser and

How to turn off persistent connections for web service calls

佐手、 提交于 2019-12-06 13:51:12
From my WinForms application I have to call a webservice and I am using a web reference for that. No problems so far, but now I have a client that uses the software behind a proxy that is behind a load balancer. Webservice calls are going fine, but after two minutes they fail. We can work around this by repeatedly calling a webservice with an interval less than two minutes. I turns out that the load balancer disconnects tcp sessions when they are not used for two minutes, appearantly this is what happens in our case and the sofware is unable to recover. How do I tell the gerenated web