.net

ASP.NET License a DLL

Hey, I have compiled my .NET application as a web deployment project and gathered a bunch of DLLs containing the code behind etc. I was wondering what is the most popular way to protect these DLL's ? Licensing came up a few times during my searches, can anyone shed more light on this ? Or any other ideas would be welcome thanks ...

A question about Image.FromStream in .NET

I'm concerned about the third parameter in this overload, validateImageData. The documentation doesn't explain much about it, it only states that it causes the image data to be validated but no details, what exactly is done to validate the image data? public static Image FromStream ( Stream stream, bool useEmbeddedColorManagemen...

How can I change an image in a Crystal report using C#

How Can I change an Image (its an OLE Object) in a Crystal report using C#? ...

Mirroring console output to a file

In a C# console application, is there a smart way to have console output mirrored to a text file? Currently I am just passing the same string to both Console.WriteLine and InstanceOfStreamWriter.WriteLine in a log method. ...

Microsoft HxS file format

I was wondering if anyone had a file format reference for Help 2.0 HxS files? I've seen a few 3rd-party viewers so obviously someone has gone through the trouble of reverse-engineering the file format, but I have been unable to track anything down with Google. I am interested in creating a better interface to the MSDN documentation and...

Export a Unity container information to xml configuration

In Microsoft Unity you can configure a container from an existing XML configuration but is there a way to do the opposite? From an initialized container export the corresponding XML configuration? ...

Would you use EnterpriseServices in a new enterprise development?

As you may already know, managed code (.NET apps) can make use of COM+ through EnterpriseServices, making issues like distributed transactions, resource pooling and synchronization "simpler to program" because the solutions are provided as a supporting infrastructure to the application by COM+. If your application servers reside in a W...

Accessing .NET/dll libraries/components from Java?

Are there inexpensive or free gateways from .NET to Java? I'm looking at some data acquisition hardware which has drivers for C/C++ and .NET -- I really don't want to do any programming in .NET. Update: I haven't done what I originally wanted to do, but I've done something similar, using JNA to encapsulate some functions from a DLL, in ...

Guidelines for Using Brushes and Pens

How expensive is it to create gdi brushes and pens? Should I create them on an add needed basis and wrap them in a using so they are disposed quickly, or should I create a static class similar to System.Drawing.Brushes class? ...

Can an internal setter of a property be serialized?

Hello fellow coder, Is there any way to serialize a property with an internal setter in C#? I understand that this might be problematic - but if there is a way - I would like to know. Example: [Serializable] public class Person { public int ID { get; internal set; } public string Name { get; set; } public int Age { get; se...

foreach with generic List, detecting first iteration when using value type

When foreaching through a generic list I often want to do something different for the first element in the list: List<object> objs = new List<object> { new Object(), new Object(), new Object(), new Object() }; foreach (object o in objs) { if (o == objs.First()) { System.Diagnostics.Debug.WriteLine("First...

Why to use CAS (Code Access Security)?

I have been a part of so many web applications but have never used CAS, perhaps have also never felt the need to use the same. When is the need to use CAS? Do people actually use it in their applications? ...

Why isn't the Byte Order Mark emitted from UTF8Encoding.GetBytes?

The snippet says it all :-) UTF8Encoding enc = new UTF8Encoding(true/*include Byte Order Mark*/); byte[] data = enc.GetBytes("a"); // data has length 1. // I expected the BOM to be included. What's up? ...

Why can't I display the ASP.NET Framework version as 3.5?

Hello, Can someone please confirm to me that when my application is written in .NET 3.5 that this code System.Environment.Version.Major.ToString() will produce this 2.0.50727.1433 I'm just moving to 3.5 and the first application I'm moving is an internal website. I thought a really easy indicator that it's working would be to add...

.NET Generics: Using an Activator created type as a generic shows wrong Type? Need workaround...

This really has my stumped today. I'm sure its simple, but... Here is my sample code: using System; using System.Collections; namespace ConsoleApplication1 { class Program { public ArrayList SomeProp { get; set; } static void Main(string[] args) { // Get the Type of a property by reflection. Type myP...

Binding a ComboBox to an IList and using SelectedValue

I have a ComboBox set up as follows, where KVPList is an IList (of KeyValuePair if it matters): comboBox.DisplayMember = "Value"; comboBox.ValueMember = "Key"; comboBox.DataSource = KVPList; I then have set up a binding with SelectedValue, binding to a BindingSource (to a DataSet). For whatever reason, the combo box always turns up bl...

Can I change the default config file?

I'm using Jeff Atwood's Last Configuration Section Handler You'll Ever Need, but it only seems to work for the default app.config file. If I wanted to separate certain settings into another file, the deserializing doesn't work, since ConfigurationManager.GetSection only reads from the application's default app.config file. Is it possib...

How do I use a C# keyword as a property on an anonymous object?

Using asp.net MVC I'd like to do this inside a view: <%= Html.TextBox("textbox1", null, new { class="class1" }) %> This statement does not compile because class is keyword in C#. I'd like to know how I can escape the property names such that this compiles. It is possible to get this to compile if I change the "class" property to "Cla...

Vista Parental Controls causing Socket Exception?

I got a strange bug report the other day and was hoping someone might be able to help me figure out the culprit. I've got a plug-in that uses the Facebook API to make calls from a desktop client program. A user reports that when he turns on Vista's Parental Controls, he gets a run-time exception. The detailed bug report is available her...

.net remoting to invoke Speech Server workflow in non-local application domain

I am implementing a Microsoft Speech Server application built on windows workflow foundation. The app manages other sub apps - users call in and the manager loads the assembly containing the correct application and invokes the workflow. The problem I'm facing is that speech serve or iis like to lock the assembly into memory, preventing ...