.net-3.5

Which Timer object should I use in long running processes in .Net?

Which Timer object should I use in long running processes in .Net? The timer will be used in a Windows Service, and I wish to find the best fit performance wise. ...

What am I doing wrong with my Regex?

Hi I am not sure what I am doing wrong. I am trying to use the asp.net regex.replace but it keeps replacing the wrong item. I have 2 replaces. The first one does what I want it to it replaces what I want. The next replace that is almost a mirror image does not replace what I want. So this is my sample code <%@ Page Title="Tour" Lang...

Thread Safety RijndaelManaged, ICryptoTransform.TransformFinalBlock?

Lets say we have this code that runs in the constructor: Dim initVectorBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(initVector) Dim saltValueBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(saltValue) Dim passPharse As String = GenerateKeyString(EncryptionKey) Dim password As Rfc2898DeriveBytes = New Rfc2...

WPF Grid ellipse overlay position

Sor far I have: <Grid x:Name="MainLibraryGrid"> <TabControl Name="TabControl1" TabStripPlacement="Bottom"> <TabItem Header="300s"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> <ColumnDefini...

Test "User Must Change Password" field in .Net 3.5

I'm trying to perform some basic AD User managment tasks in C# using .Net 3.5 I've got a System.DirectoryServices.AccountManagement.UserPrincipal object that contains the user details. I can call user.ExpirePasswordNow() and the user will be forced to changed their password at next login (and the "Active Directory Users and Computers" ...

LINQ - Set element in Dictionary to empty where DateTime value is oldest

I have a Dictionary<string, XMLMessage> where XMLMessage is a struct: private struct XMLMessage { public string Message { get; set; } public DateTime TimeRead { get; set; } } I will use the Dictionary similar to this: storedMessages["1X"] = new XMLMessage() { Message = "<XML>1X</XML>", TimeRead = DateTime....

How to create a thread-safe pool of objects?

In my server application (written in C#), I need to create a pool of same type of objects. I pull an object from pool when I need, and it goes back to pool when it is no longer needed. Mechanism needs to be thread safe since different threads will be asking and submitting these objects. I understand that frequently locking something to m...

Why doesnt Regex.Match have a GetEnumerator function?

Regex.Match has a .Success and .NextMatch why doesnt it have a GetEnumerator function? With my logic it seems easy enough to implement. But it isnt in 3.5 so can anyone tell me why not? foreach (var m in Regex.Match("dummy text", "mm")) error CS1579: foreach statement cannot operate on variables of type 'System.Text.RegularExpressions...

Is there a workaround to IE7's user agent being defaulted after installing .Net Framework 3.5 SP1?

I have verified that after installing the .Net Framework 3.5 SP1, when the User Agent string exceeds a certain number of characters, the user agent is defaulted to 'userAgent string:Mozilla/4.0 (compatible; MSIE 6.0)'. I've verified this behavior on several machines but can't seem to find a suitable workaround. This is preventing some Si...

iTextSharp asp.net Bulleted List to PDF

Hi There, I have a asp.net web page with some contents and a BulletedList with some international characters, I am using iTextSharp library to export to PDF format. How can I export only this BulletedList with international characters to PDF. Any Ideas? Thanks ...

Up-to-date XML-Documentation Builder for C#

I want to start using XML-Documentation of my code and am desperately searching for an up-to-date (meaning .NET-3.5 SP1) to do so. I found NDoc, but it only supports .NET-1.1 and that a little bit far away ;-) Any suggestions? ...

XmlDocument.Save omitting elements

I have the following XML that is built up at runtime using an XmlDocument: <?xml version="1.0" standalone="yes"?> <NewConfig xmlns="http://tempuri.org/NewConfig.xsd"&gt; <SystemReference xmlns=""> <ID>1</ID> <Name>CountryName</Name> </SystemReference> <ClientList xmlns=""> <Type>Private</Type> <!-- elements omitte...

Proper usage of xml file-based storage as database alternative in ASP.NET site

I'm building a small application and to reduce hosting costs and dependencies, I am planning to store all persistent data to xml files rather than a Sql Server database. In this case, the site audience is limited to friends and family - no more than a few concurrent users are ever expected, so the site does not need to scale. Is it fea...

Using App.config to set strongly-typed variables

I'm a C# novice running .NET 3.5, and I'd like to store a bunch of application default values in App.config, as the settings may vary by server environment (e.g. development, staging, production). What I want to do is similar to what's described in this StackOverflow article, but I also want to be able to use non-string values (e.g. int...

Is there a way to read from Response Headers without getting a PlatformNotSupportedException?

Hello, I am working on an Filter Attribute for ASP.Net MVC that will return a 304 response when the content has not been modified. It would be handy to be able to read the Last-Modified header value set in the Controller in order to accomplish this... there just seems to be one problem. I can't seem to find a way to read the headers when...

Creating a user interface for monitoring and interacting with a running windows service

I need to run a bunch of pluggable processes in a windows service on my server and want to create a user interface that allows me to interact with each of the plugins in use by the service. What is the most common method (or methods) for communication between a user interface and a long-running windows service? I am thinking of providin...

How to upgrade to .NET 3.5?

Our company uses .NET 2.0 to develop server application which is installed at a number of large customers. We still use 2.0 only because it is installed on all customer servers by default. For us, as developers, this is sometimes total madness, especially for those who migrated from .NET 3.5. We can't use most powerful language and fram...

Linq to SQL: Ammend command before submission to database

Is there a hook somewhere within Linq to SQL that would allow me to manually modify a command before it is sent to the database? Specifically, I am trying to introduce the WITH CHANGE_TRACKING_CONTEXT(@contextData) syntax whenever an insert/update/delete is applied to the database in order to be able to add additional information agains...

Will closing a FileStream close the StreamReader?

If I use a FileStream to create a StreamReader, will the StreamReader close when I close the FileStream or will I need to close the StreamReader too? public void ReadFile() { var file = new FileStream("c:\file.txt", FileMode.Open, FileAccess.Read); var reader = new StreamReader(file); try { txtFile.Text = reader.Re...

Wpf - Nesting databinding and Validators

I am returning to WPF after a year of winforms development and am trying to get my eye back in with a small project. I am creating a simple 'Filename Textbox' which is a usercontrol with a textbox and a button ("...") which spawns the FileOpenDialog. On this usercontrol I have declared a dependency property of Filename which the Textbox...