.net

How to put WS-Policy in WSDL document

I have an external xml file which declare WS-policy as shown below: <?xml version="1.0" encoding="utf-8"?> <wsp:Policy xmlns:wsp="http://www.w3.org/2006/07/ws-policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" ...

Process.Start dirquota.exe - The system cannot find the file specified

Hi, Banging my head against the wall for around 2 days with this one. I am using a System.Diagnostics.Process to execute dirquota.exe. I catch an exception at .Start() which is "The system cannot find the file specified". I am now doing: foreach (var fi in new DirectoryInfo(@"C:\Windows\System32\").GetFiles()) ...

DispatcherTimer with Window.Close causing crash.

I am writing a C# app that has a main window and a separate login window. I set a DispatcherTimer to open a new login window if the user is idle for a certain period of time. My app is crashing when i call .Close() on the login window. However, if I remove the DispatcherTimer code it works fine. Is System.Timers.Timer a better choice...

Passing Null Values to Web Services Via SOAP Using Excel VBA

I have a Web Service which has one WebMethod with nullable parameters: [WebMethod] public void SaveValue(double? Real, double? Meta){ //Do the magic... } In my Excel I'm calling the WebMethod as below: Dim WebSvc As MSSOAPLib.SoapClient Set WebSvc = New SoapClient Call WebSvc.mssoapinit("http://localhost:10618/WebService.asmx?wsdl"...

Why doesn't this code demonstrate the non-atomicity of reads/writes?

Reading this question, I wanted to test if I could demonstrate the non-atomicity of reads and writes on a type for which the atomicity of such operations is not guaranteed. private static double _d; [STAThread] static void Main() { new Thread(KeepMutating).Start(); KeepReading(); } private static void KeepReading() { whil...

With Process PerformanceCounters how do I know what process an instance is associated with?

When querying instances for the the "Process" performance counter category there might be multiple instances of of a process with the same name. For example this code: var cat = new PerformanceCounterCategory("Process"); var names = cat.GetInstanceNames(); foreach (var name in names) Console.WriteLine(name); Might print these r...

WP7 Prevent ListBox scrolling

I have a page with two ListBox controls. The page contains a list of items based on the item's category. There is a header for a category, followed by a ListBox containing all items for that category, then another header followed a list of items for that category, etc. The issue I'm having is that each ListBox scrolls independently. I...

RightFax and .NET?

How easy is it to integrate RightFax with .NET/C#? We are considering FaxMan, Windows Fax Server also, but we came across RightFax. We basically need to be able to send faxes through a .NET App, monitor status etc. ...

Display a C# message onlyonce

Hello, I would like to make a C# application that displays a message when the program starts up, with a button that says "Don't show this message again". When they click that button, how do I make it not display again the next time the program is ran. Any and all help would be greatly appreciated. Also, I'm unsure on how to show a me...

Is IP address on the same subnet as the local machine (with IPv6 support)

Does anyone have some code that will determine if an IP address (IPv4 or IPv6) is on the same subnet as the machine running the application? I've seen numerous examples of code that does this with IPv4 but I can't find any that support IPv6. ...

What is the use case for Access.BackingField in Fluent NHibernate?

The documentation for Access.BackingField() indicates that this: Sets the access-strategy to use the backing-field of an auto-property. I understand that auto-properties get compiled with backing fields, but if the property is by definition a vanilla getter/setter, what advantage is garnered by going to the backing field directly v...

using Regular Expressions and tags to extract portion of text

So I have a text file that is having special tags like: {A1} Text 1 {A1} {A2} Text 2 {A2} How can I extract from the text using reg-ex the portion Text 2 or Text 1 ..? So I what to be able to extract only what is between tags A1 or only what is between Tags A2 .. not all of them ... at once! thanks! ...

NHibernate Contextual Sessions in ASP.NET MVC

I want to use NHibernate's Contextual Sessions in my ASP.NET MVC 2 application, but I'm having a hard time finding guidance on how to properly do this. I'm interested in Session per request. ...

How can I convert MS Excel 2.x files into CSV format?

I currently have MS Excel 2.x (BIFF2) files that I receive from a client. They need to be loaded into an ETL system via SSIS. From what I can tell and from my tests, SSIS cannot read these files directly. I have also tried using Aspose.Cells for .NET to open / convert these files in .NET with no luck. Hopefully there is another way t...

C# .NET Serialization - how to include schema in output

I've produced a class using the XSD.EXE for an XML web service. My question is how do I include the schema? Current XML output: <?xml version="1.0" encoding="utf-8"?> <dsXmlSummary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.tempuri.org/dsXmlSummary.xsd"&gt; <ad...

Two different versions of Silverlight Control

I have a really strange issue in my project. I have a facebook app which loads a silverlight control in an iframe. Right now the app is pointing to my localhost. Now the strange thing is if I open the app in two different browser with the same address, it load two differen versions of the same silveright control. (One i start by debugg...

How do I check if a VB6 application is running (and not hung on a system error) from C#?

I need to monitor a legacy application written in vb6 from a C# service and force-quit/relaunch it whenever it hangs. How do I check if a VB6 application is running (and not either hung on a system error or crashed completely) from C#? Thanks! ...

Client/Server Authentication with SSLStream

Hello, I have a client and server application which use SSLStream to communicate over port 80. Both the client and the server are running as Windows Services. Everything works in my test environment (my development computer, under the OS Windows 7 Ultimate). My problem is that when I go to deploy the client and server application to ...

Find and replace algorithm

Hello, i have some text files that contain <img width="100" or <img width="1400" or.... How could i replace all above with the following, since the image width is not static? <img width="200" ...

How do I programmatically generate an xml schema from a type?

Hi, I'm trying to generate an xs:schema from any .net Type programmatically. I know I could use reflection and generate it by iterating over the public properties, but is there a built in way? Example: [Serializable] public class Person { [XmlElement(IsNullable = false)] public string FirstName { get; set; } [XmlElement(IsNull...