.net-2.0

Finding network alias in .net

Is there a way in .net 2.0 to discover the network alias for the machine that my code is running on? Specifically, if my workgroup sees my machine as //jekkedev01, how do I retrieve that name programmatically? ...

Best method to obfuscate or secure .Net assemblies

I'm looking for a technique or tool which we can use to obfuscate or somehow secure our compiled c# code. The goal is not for user/data security but to hinder reverse engineering of some of the technology in our software. This is not for use on the web, but for a desktop application. So, do you know of any tools available to do this t...

XmlSerializer - There was an error reflecting type

Using C# .NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception saying: There was an error reflecting type. Inside the data class t...

.Net 2+: why does if( 1 == null ) no longer throw a compiler exception?

I'm using int as an example, but this applies to any value type in .Net In .Net 1 the following would throw a compiler exception: int i = SomeFunctionThatReturnsInt(); if( i == null ) //compiler exception here Now (in .Net 2 or 3.5) that exception has gone. I know why this is: int? j = null; //nullable int if( i == j ) //this s...

Add Custom TextboxCell to a DataGridView control that contains a button to open the FileDialog

I would like to add a DataGridViewTextBoxCell cell to a DataGridViewCell control, but as well as being able to type in the text cell as normal it must also contain a '...' button that once clicks brings up the OpenFileDialog window to allow the user to select a file. Once selected, the text cell will be populated with the full file path....

Split out ints from string

Let's say I have a web page that currently accepts a single ID value via a url parameter: http://example.com/maypage.aspx?ID=1234 I want to change it to accept a list of ids, like this: http://example.com/mypage.aspx?IDs=1234,4321,6789 So it's available to my code as a string via context.Request.QueryString["IDs"]. What's the ...

Publishing Website fails for some pages

I have a strange problem when I publish my website. I inherited this project and the problem started before I arrived so I don't know what conditions lead to the creation of the problem. Basically, 3 folders below the website project fail to publish properly. When the PrecompiledWeb is transferred to the host these three folders have to...

.net: System.Web.Mail vs System.Net.Mail

I am considering converting a project that I've inherited from .net 1.1 to .net 2.0. The main warning I'm concerned about is that it wants me to switch from System.Web.Mail to using System.Net.Mail. I'm not ready to re-write all the components using the obsolete System.Web.Mail, so I'm curious to hear if any community members have had ...

How to publish wmi classes in .net?

I've created a seperate assembly with a class that is intended to be published through wmi. Then I've created a windows forms app that references that assembly and attempts to publish the class. When I try to publish the class, I get an exception of type System.Management.Instrumentation.WmiProviderInstallationException. The messag...

VS2008 Setup Project always requires .NET 3.5 at install time but I don't need it!

1, Create and build a default Windows Forms project and look at the project properties. It says that the project is targetting .NET Framework 2.0. 2, Create a Setup project that installs just the single executable from the Windows Forms project. 3, Run that installer and it always says that it needs to install .NET 3.5 SP1 on the mac...

asp.net dropDownBox selectedIndex not being maintained.

I have a weird problem with a dropdownbox selectedIndex always being set to 0 upon postback. I'm not accidentally rebinding it in my code. In fact I've placed a breakpoint at the very first line of the page_load event and the value is already set to zero. The dropdown is in the master page of my project, I don't know if that makes a diff...

Serializing SQL CE data to XML

I'm working on a product feature that will allow the user to export data from a SQL CE database on one copy of my application and re-import it into SQL CE on the other end. This data is not whole tables, but the result of queries. I had hoped to take advantage of .net's built-in XML-based serialization like in DataTable.WriteXML. But, n...

IIS Authentication across servers

My production environment involves a pair of IIS 6 web servers, one running legacy .NET 1.1 applications and the other running .NET 2.0 applications. We cannot install .NET 2.0 alongside 1.1 on the same machine because it is a tightly-regulated 'Validated System' and would present a bureaucratic nightmare to revalidate. Websites on bot...

How does the Multiview control handle its Viewstate?

Does the Multiview control contain the viewstate information for each of its views regardless of whether or not the view is currently visible? ...

Fade splash screen in and out

In a C# windows forms application. I have a splash screen with some multi-threaded processes happening in the background. What I would like to do is when I display the splash screen initially, I would like to have it appear to "fade in". And then, once all the processes finish, I would like it to appear as though the splash screen is "fa...

javascript message box

Dear all; I want to display an error message on my asp.net application. This message is a warning message, this is the way I did it: CmdCalcInvoke.Attributes["onclick"] = "return confirm('Are you sure you want to calculate the certification? WARNING: If the quarter has not finished, all the partners status will change')"; The code abo...

Performance when checking for duplicates

I've been working on a project where I need to iterate through a collection of data and remove entries where the "primary key" is duplicated. I have tried using a List<int> and Dictionary<int, bool> With the dictionary I found slightly better performance, even though I never need the Boolean tagged with each entry. My expectation ...

Temporarily load SSL Client Key for Client Authentication in C#

I am using the WebBrowser control to add a WebInterface to C# app. My desire is to verify that only such app is able to connect to our Web server using SSL client certificates. My idea was to embed the client certificate in the app and just use when connecting via my app. Anybody have a sugestion on how to do this? Or the only way to ma...

How can I build C# ImageList Images from smaller component images?

I'd like to make status icons for a C# WinForms TreeList control. The statuses are combinations of other statuses (eg. a user node might be inactive or banned or inactive and banned), and the status icon is comprised of non-overlapping, smaller glyphs. I'd really like to avoid having to hand-generate all the possibly permutations of ...

How to implement paging for asp:DataList in .NET 2.0?

I spent hours researching the problem, and just want to share a solution in case you ever need to implement paging for asp:DataList in .NET 2.0. My specific requirement was to have "Previous" and "Next" links and page number links. ...