.net

Handling delays during stop/pause requests on Windows service

I have a Windows service class deriving from ServiceBase that uses a System.Timers.Timer to run code at frequent intervals. The handlers for OnStop and OnPause use some signalling with the timer thread to check if the timer is still running and waits for it to finish. Is there a recommended way of handling delay errors in this situation...

Silverlight: Expose audio with specific start and stop times

From an audio-file I want to be able to expose audio on a webpage, but between specific start and stop times. Say I have a audio-file that is 45:30, for example, and I want to expose it for streaming and download between 7:25 and 8:30, but also between 6:20 and 9:27. What do I need in term of special services, Silverlight-controls and ...

Association references unmapped class exception

I'm trying to map the Northwind Employee entity with NHibernate: public class Employee { public virtual int ObjectID { get; set; } public virtual string LastName { get; set; } public virtual string FirstName { get; set; } public virtual string Title { get; set; } public virtual string TitleOfCourtesy { get; set; } ...

Unable to regress web application from AJAX Control Toolkit 3.0 back to 1.0

I was recently asked to stop using the Ajax Control Toolkit 3.0 in my application and need to go back to 1.0. Luckily I only have one calendar control which I don't believe will be affected by this. I have removed the reference to the 3.0 .dll and added a reference to the 1.0 .dll. These are the assemblies in web.config: <asse...

What is the equivalent in .NET for ChrToOemA from VB6?

I'm migrating an application from VB6 to .NET and in VB6 i have a a call to this method: CharToOemA. I don't understand what it does and how I can reproduce this functionality. The line in VB6 is like this: Call CharToOemA(Text, Text), where Text is a string. Is there an equivalent in .NET for CharToOemA from VB6? If there isn't how can...

Setting CommandBehavior for executing commands in Entity Framework

How can I specify CommandBehavior (for e.g. SequentialAccess) when executing a command on entities? ...

Why would SmtpClient behave differently on XP/Vista/Win7

I'm using the following code which appears to work perfectly every time on Vista/Win7. private void SendEmail(string subject, string body, string attach) { using (MailMessage message = new MailMessage("[email protected]", "[email protected]", subject, body)) { message.IsBodyHtml = true; if (!string.IsNullOrEmp...

Protecting XML file from editing

We have around 60 MB of device configuration implemented in at least 1000 xml files. Now we are releasing the software to the customers. But our requirement is not to allow the user to view and edit the xml configuration files. XML configuration files contains a lot of secret of the device information which can be easily hacked if it i...

How do I write a Windows HyperTerminal (.ht) file?

From my C# .NET application, I want to generate a .ht file that can be used to launch an instance of HyperTerminal and connect to the IP/Port specified in the .ht file. Does anyone know how to format the binary .ht file? ...

Event handling with an anonymous delegate

For the record: I found a similar question here but I have to elaborate a bit more on on the subject. My concrete scenario is this: In Silverlight 4, The myFrameworkElement.FindName("otherElementName") method seems to work fine now, but I encountered a problem. It still returns null when the element is not yet added to the visual tree ...

Get SVN External over HTTP

In my code, I'm using a System.Net.WebClient to get individual files from an SVN repository, and this works fine. I have an SVN external that I want to get some files from, and therefore cannot access these files in the same manner. What I would like to do is find what location the external is actually pointing to and then get the file...

Will this code work on your version of Visual Studio? C#

Hello, I want to use this code to grab all methods from the assembly "Mscorlib.dll" but i get this error "Unable to cast object of type 'System.Reflection.RuntimeConstructorInfo' to type 'System.Reflection.MethodInfo'." Basically all I want to do is get a list of interfaces or Members of that assembly. Heres the code: using System;...

asp.net hosting ecnomically

Right now A website for NON PROFIT organization developed using ALL FREE open source technologies. ( Apache, Php , Mysql ) We really want to change ( Rewrite) it to Microsoft asp.net 3.5. Do I need to buy licensed copy of .net ? can I use free express edition? Being a non profit organization, Budget is the main problem. How can I deve...

.NET Enumeration allows comma in the last field

Why in this planet .NET enumeration are allowed to have comma in the last field? Is this has any special meaning? [FlagsAttribute] public enum DependencyPropertyOptions : byte { Default = 1, ReadOnly = 2, Optional = 4, DelegateProperty = 32, Metadata = 8, NonSerialized = ...

How to make PostgreSQL trigger and C# Windows Service work together?

Hi, I want to write a windows service in C# that will wait for a change in the particular table in PostgreSQL database and then operate based on the data from the last inserted row. As far as I know (I'm new to PostgreSQL) I can use triggers to execute a function in structural code - but how to make it pass the data to my service? Tha...

FiddlerCore + autoresponder?

I have just discovered FiddlerCore (a .NET API to automate some Fiddler functionality) and I would like to use this in combination with Fiddler's autoresponder to run some automated testing given a set of predefined request-->response sessions (which is how autoresponder works, I believe). I cannot figure out how to set this up with Fid...

How to use array value for case switching (not array number)

How do you use the VALUE of an array number as opposed to what number in the array it is for determining case? In my code: for (int x = 0; x < 3; x++) { switch (position[x]) { case 0: label1.Text = people[x]; break; case 1: ...

NET Framework Validation Library

As I see it most applications have a requirement for some form of validation and a number of fantastic free offerings are available (I.E., Fluent Validation, Validation Block, Spring, Castle Windsor, etc). My question is why does the .NET Framework not include any inbuilt validation libraries? I am aware the .NET Framework allows a dev...

Can someone please help me understand this Regular Expression?

I have the following regular expression: (?=.{8,})[a-zA-Z]+[^a-zA-Z]+|[^a-zA-Z]+[a-zA-Z]+ I do not understand the "?=" part of it. My basic (incorrect) understanding is that it is saying a string that is 8 characters or more long, which has one or more letters followed by one or more non-letters, or one or more non-letters followe...

What is the best approach to versioning the tracked data within workflows ?

This is a general question concerning the Workflow Foundation (.NET 3.5) and versioning the data that it works with. We have a lot of custom activities that work with some data and this data may be interesting also for the future analysis of the already completed workflows (provided that we configure the tracking in such a way that it st...