.net-4.0

C# to convert xml attributes to elements

青春壹個敷衍的年華 提交于 2019-12-19 22:01:53
问题 I need to convert all attributes to nodes in an XML file, with the exception of attributes in the root node. I found a similar question here: xquery to convert attributes to tags, but I need to do the conversion in C#. I have also found a possible solution using XLS here: Convert attribute value into element. However, that solution essentially changes the node name to the attribute name and removes the attribute. I need to create new sibling nodes with the name and value of the attributes and

Loading AjaxControlToolkit Scripts from Microsoft's CDN using ScriptManager/ToolkitManager

岁酱吖の 提交于 2019-12-19 21:44:20
问题 I know there is another question asking the same thing, but it hasn't gotten any attention for months now: https://stackoverflow.com/questions/3786088/how-to-force-ajax-control-toolkit-scripts-loading-from-cdn I've upgraded my website to .NET4, and I'm now using the scriptManager's EnableCDN="true" tag. My Ajax scripts are being referenced from the Microsoft CDN just how I expected, but I can't seem to get my AjaxControlToolkit scripts to load from the CDN. Instead they all load locally

How to create a method that suport translation to sql?

本秂侑毒 提交于 2019-12-19 17:38:07
问题 I wanted to use a method I created inside a query coz i need to implement a peculiar type of filter... return manager.Clients.SelectAll().Where(cli => cli.Name.SatisfyFilter(filter.Name) && cli.LastName.SatisfyFilter(filter.LastName) && cli.MiddleName.SatisfyFilter(filter.MiddleName)).ToList(); But i get the: "Method 'Boolean SatisfyFilter(System.String, System.String)' has no supported translation to SQL." Error My method is: public static bool SatisfyFilter(this string palavra, string

.Net 4.0 is encoding single quote when using Attributes.Add

懵懂的女人 提交于 2019-12-19 16:09:35
问题 .Net 4.0 is encoding single quotes when I am using Attributes.Add to add client side events to my asp.net objects. In the previous versions this didn't happen. for example : <asp:Image runat="server" ID="imgTest" ImageUrl="~/DateControl/cal.gif" /> imgTest.Attributes.Add("onmouseover", "alert('Hello')"); When I view the client side output, I am getting <img id="ctl00_MainContent_calFromTimeStamp1_imgTest" onmouseover="alert('Hello')" src="../DateControl/cal.gif" style="border-width:0px;" /> I

Proper calling convention of unmanaged DLL function

耗尽温柔 提交于 2019-12-19 11:16:17
问题 I'm trying to write a bare-bones ultra-simple light-weight wrapper for the LibVLC DLL Library. I don't need access to much, just the ability to play pause and stop media files. I'm looking at the documentation and this other link I found that explains an older version of LibVLC, but it's outdated for the most recent version. I also tried LibVLC.Net but it too is outdated and I can't find what I'm looking for in the source code to match it to the functions I'm trying to export. I have the

Issue to use TLS 1.2 in .NET Framework 4.0

纵然是瞬间 提交于 2019-12-19 10:20:13
问题 I got TLS 1.0 disabled. So we are trying to use TLS 1.2 in our .Net application which is using .Net Framework 4.0. I have added the code for this at the start System.Net.ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; It works perfectly on my local system. But i am not sure why its not working when I deploy the code on server (Windows Server 2008 R2). I checked everything. .Net framework is present on server. But still its giving the same issue on server only. Is there

Issue to use TLS 1.2 in .NET Framework 4.0

蓝咒 提交于 2019-12-19 10:19:33
问题 I got TLS 1.0 disabled. So we are trying to use TLS 1.2 in our .Net application which is using .Net Framework 4.0. I have added the code for this at the start System.Net.ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; It works perfectly on my local system. But i am not sure why its not working when I deploy the code on server (Windows Server 2008 R2). I checked everything. .Net framework is present on server. But still its giving the same issue on server only. Is there

C# Collection select value of the property with minimum value of another property

我的未来我决定 提交于 2019-12-19 10:15:37
问题 So let's say I have a type Car with two properties Speed and Color public class Car { public int Speed {get; set;} public string Color {get; set;} } Using LINQ I may find the minimum speed int minSpeed = collection.Min(em => em.Speed); so minSpeed will contain the value of speed of the car with the minimum speed in collection. But how can I do something similar to get the color of the car? Something like: string color = collection.Min(em => em.Speed).Select(x => x.Color); 回答1: Use MinBy. Car

SmtpClient wont authenticate over SSL/TLS (not pointing to gmail)

别等时光非礼了梦想. 提交于 2019-12-19 09:15:10
问题 I have an ssl/tls server (nodejs) that acts as a proxy to postfix/sendmail to perform some pre-processing/data aquisition on outgoing mail. From C#, I can manually connect and authenticate with the following code: var sslStream = new SslStream(tcpClient.GetStream(), false, new RemoteCertificateValidationCallback(CertificateValidation), new LocalCertificateSelectionCallback(CertificateSelectionCallback)); string fn = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cert.pem");

LINQ to Entities does not recognize the method Generic.List(int) to Generic.IEnumerable(int) method

眉间皱痕 提交于 2019-12-19 08:54:02
问题 The database contains Orders. Orders can be contained within a group of Orders. For every group of Orders it could contain 1 to many Orders. However, Orders could have a NULL value assigned GroupOrderId as previous Orders did not have the grouping concept. Only new Orders enforce the concept of being added to a group. The class structure to be populated in order to perform actions on each Order is public class OrdersGroup { public int? GroupOrderId { get; set; } public List<int> OrderIds {