.net

How to add custom Authentication Type in IIS7(.5)

I am busy developing a IHttpModule, which will do our custom authentication using our own credential store. I would like to know how to add a new custom Authentication Type to the list (Anonymous, Basic, Forms etc.) in InetMgr under Authentication and how I would know which Authenticaiton Type has been enabled in the IHttpModule class...

Erlang-style light-weight processes in .NET

Is there any way to implement Erlang-style light-weight processes in .NET? I found some projects that implement Erlang messaging model (actors model). For example, Axum. But I found nothing about light-weight processes implementation. I mean multiple processes that run in a context of a single OS-thread or OS-process. ...

Unqualifing a xml in c#

Hello, Is there an smart way of unqualifing (clean namespaces references) a XML in c#? All the xml references the same schema. Thanks in advance. ...

Multithreading and booleans

Hi Everyone, I have a class that contains a boolean field like this one: public class MyClass { private bool boolVal; public bool BoolVal { get { return boolVal; } set { boolVal = value; } } } The field can be read and written from many threads using the property. My question is if I should fence the g...

Avoiding dispose of underlying stream

I'm attempting to mock some file operations. In the "real" object I have: StreamWriter createFile( string name ) { return new StreamWriter( Path.Combine( _outFolder, name ), false, Encoding.UTF8 ) ); } In the mock object I'd like to have: StreamWriter createFile( string name ) { var ms = new MemoryStream(); _files.Add( Path.Com...

C# Proxy using Sockets, how should I do this?

I'm writing a proxy using .NET and C#. I haven't done much Socket programming, and I am not sure the best way to go about it. What would be the best way to implement this? Should I use Synchronous Sockets, Asynchronous sockets? Please help! It must... Accept Connections from the client on two different ports, and be able t...

XML Deserialization of complex object

I have xml structure like this: <Group id="2" name="Third" parentid="0" /> <Group id="6" name="Five" parentid="4" /> <Group id="3" name="Four" parentid="2" /> <Group id="4" name="Six" parentid="1" /> parent is denotes Group's Id. The Constructor of Group reads like: public Group(string name, int ID, Group parent) While De-seri...

How to store the Connenction String in only the Data Access Layer (.NET Class Library)

Hi! I got a solution that includes 3 different projects, a Class Library, a Web Service and a Windows Service. MySolution.DataAccessLayer (Class Library) Using Entity-Framework 3.5 to access the database. MySolution.WebService (Web Service) MySolution.WindowsService (Windows Service) My problem is that a have to include the Connect...

Using Prism with Ninject

Is anyone out there using the Prism framework with Ninject instead of Unity? I need some functionality Unity isn't supporting yet, and I've decided to switch the IoC container to Ninject. I'm struggling a bit with the replace though.. What I need to use from Prism is the EventAggregator and the RegionManager. I have seen this sample th...

Capturing unhandled exceptions in .Net 2.0. Wrong event called.

Hello, I'm investigating a bit about how the unhandled exceptions are managed in .Net and I'm getting unexpected results that I would like to share with you to see what do you think about. The first one is pretty simple to see. I wrote this code to do the test, just a button that throws an Exception on the same thread that created the ...

Regular expression to validate name in .NET multilingual web application

Hi, how can i write a regular expression to validate name field in a multilingual web application, i want to validate the name field for non-English languages e.g. Spanish or German, and we need to make sure that no one enter digits or special characters. I'm using .NET 2.0 I believe we can't use expression as below for non-English lan...

Error while installing a .net setup executable locally

Hello I have created a setup for my windows application in .NET 2008 After building the same i have the .msi and setup.exe files in my release folder. The problem i am facing is : I can install the application using the msi installer files from the shared network folder. But when i copy the installer locally and tried to install it, ...

DLL Deployment Strategies

If you have a modular applicaiton that depends on its modules to be in seperate libraries ( dlls ). What kind of Re-deployment strategy would be good to follow? The application is installed using the Setup Project that is available in Visual Studio. I would like to avoid the copy and paste approach! ...

What is the IServiceLocator interface?

From what I understand IServiceLocator is an interface to abstract the actual IoC container away? I'm asking with relation to Prism where I'm trying to replace Unity with Prism, and I see Prism-classes relying on IServiceLocator. Could someone please clarify the role of the interface and when it is used? And also; what is the Common Se...

.Net Regular expression - how to do an exact match exclusion on a full string?

I need a .Net regular expression that matches anything OTHER than the exact full string match specified. So basically: ^Index$ ... is the only exclusion I care about. Strings can start with, finish with or contain "Index", but not match exactly. My brain doesn't seem to be working today and I'm failing to work this one out. EDIT The...

C# myths about best practices?

My colleague keeps telling me of the things listed in comments. I am confused. Can somebody please demystify these things for me? class Bar { private int _a; public int A { get { return _a; } set { _a = value; } } private Foo _objfoo; public Foo OFoo { get { return _objfoo; } ...

How Random is System.Guid.NewGuid()? (Take two)

Before you start marking this as a duplicate, read me out. The other question has a (most likely) incorrect accepted answer. I do not know how .NET generates its GUIDs, probably only Microsoft does, but there's a high chance it simply calls CoCreateGuid(). That function however is documented to be calling UuidCreate(). And the algorithm...

Obtaining statistical Performance Counters via WMI in C#.NET

Hi all, Is there a way to create a Refresher object to obtain statistical Performance Counters data in .NET? There are plenty examples how to do it in unmanaged C++ and in VBScript, but no one in C#.NET Sincerely, Ilya Sotin ...

Why won't my WPF XAML Grid TranslateTransform.X ?

I'm able to change the width/height of the grid using this, so why won't it work when I use (Grid.RenderTransform).TranslateTransform.X as such: <Window.Triggers> <EventTrigger RoutedEvent="Button.Click" SourceName="button"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="(Grid.RenderTrans...

Raise differing beeps

I need to be able to raise different types of audio notifications to the user. I need an "ok" and an "error" type sounds, I was hoping to be able to raise a simple beep and a critical stop type sound but I can only find the Beep() command which doesn't allow for differing sounds. Is there a library that does what I need or will I need ...