.net-2.0

What's the best method of Encryption whilst using ProtoBuf?

I've migrated my database on my mobile device away from VistaDB because it's just too slow. I'm now using ProtoBuf instead to create a series of flat files on a Storage Card, the only issue is there's obviously no encryption. Which encryption method works best with ProtoBuf? I'm basically serializing a collection of data entities to a f...

Does ASP.NET need to be configured for Full Trust to implement 'PageHandlerFactory' ?

Our hosting platform (running IIS6/ASP.NET 2.0) is configured to run under partial trust. In the machine wide web.config file we set the ASP.NET trust level to Medium (and lock to prevent overrides) and use a modified policy file. When trying to add a custom HttpHandler to handle .aspx requests for a website running in this configurati...

Enumerate through a subset of a Collection in C#?

Is there a good way to enumerate through only a subset of a Collection in C#? That is, I have a collection of a large number of objects (say, 1000), but I'd like to enumerate through only elements 250 - 340. Is there a good way to get an Enumerator for a subset of the collection, without using another Collection? Edit: should have men...

Converted project .net 2.0 to 3.5, where are the extension methods?

Hi, I've recently converted an app from .net 2.0 to 3.5 but I don't see any extension methods... what am I doing wrong? Or what else should I do besides changing the target framework from 2.0 to 3.5 in project settings? ...

How to stop a service within the OnStart method?

I'm writing a windows service in .net 2.0. What should I do within the OnStart method if for some reason I don't want it to start? Can I simply call the Stop() method of the base class (ServiceBase)? I've tried that and am getting some funny memory access exceptions. Is it required to start a separate thread to call the Stop() method? ...

How can I convince my admins to upgrade from ASP.NET 2.0 to 3.5?

I am trying to convince my web server admins to upgrade our version of the .NET framework from 2.0 to 3.5. I was wondering what are the best reasons to upgrade, from a server admin prospective. Obviously, there are the over arching ideas of keeping up to date, security, and so forth. I am looking for some hard and fast reasons that will...

.NET custom form designer: How to implement IMenuCommandService?

I've got a report form designer written long ago for a database project. It used a lot of winapi magic hence i was forced to rewrite some parts 'in proper way'. Thanks to some articles from MSDN magazine (here and here) and CodeProject i was able to implement designer surface, toolbox and undo/redo engine. Every resource i discovered ...

DataTables vs List(Of Object)

I'm having a debate with another programmer I work with. Are there any significant memory usage or performance differences, or other cons which should make someone avoid using the DataTable and favour lists(of object)... or vice versa I prefer using the lists because they are more lightweight, strong typing to the object when accessing...

Dundas vs ComponentArt which one is better

Planning to buy a charting solution (for ASP.NET), narrowed down to Dundas and componentArt. Is there a feature comparison sheet, comparing these two components? Has anyone used both of these and found any one of them to be better than the other? I had used ComponentArt in a project before and was impressed with its 3d like color sett...

Generic dictionary class key value

Hi all, As I know, in HashTable the key string's hash value is unique because if there are two same strings, the GetHashCode() function will overwrite the first one with the second. This will ensure that there's no identical hash values generated by the different strings with same values. But when it comes to generic dictionary class...

Regex: Named Capturing Groups in .NET

I'm having a hard time finding a good resource that explains how to use Named Capturing Groups in C#. This is the code that I have so far: string page = Encoding.ASCII.GetString(bytePage); Regex qariRegex = new Regex("<td><a href=\"(?<link>.*?)\">(?<name>.*?)</a></td>"); MatchCollection mc = qariRegex.Matches(page); CaptureCollection c...

The client (desktop app) pulls data...but I want the server (web app) to push data

I have a client-server application - wherein the server is essentially an ASP .NET web application and the distributed clients are desktop applications. The clients need to receive some data from the server - when there is new data for the client. Right now, the way this is done is - the client keeps querying a web service every x minut...

Get hardware Info.

How to get hardware information of a system using c# code? ...

How to subscribe to other class' events in c#?

A simple scenario: a custom class that raises an event. I wish to consume this event inside a form and react to it. How do I do that? Code examples, please! Note that the form and custom class are separate classes. ...

TimeSpan using a nullable date

How can i subtract 2 dates when one of them is nullable? public static int NumberOfWeeksOnPlan(User user) { DateTime? planStartDate = user.PlanStartDate; // user.PlanStartDate is: DateTime? TimeSpan weeksOnPlanSpan; if (planStartDate.HasValue) weeksOnPlanSpan = DateTime.Now.Subtract(planStartDate); // This line is ...

Check string to see if a string within a a string array occurs within it

Hi , I have a generic list of string: List listOfString = new List(); I then add 4 strings to this list: listOfString .Add("test1"); listOfString .Add("test2"); listOfString .Add("test3"); listOfString .Add("test4"); I want to check check a string variable if it contains any element within my string a...

Deployed .net app on new machine and getting "The system cannot execute the specified program"

I have a .net console app that launches excel. I have it working on my development enviornment, but I can't get it running on my production environment. When I try to run it I receive the following error "The system cannot execute the specified program". I have installed .net 2.0 sp2 on my production server. Any ideas? Thank you, C...

Asp.Net Caching and memory leaks when removing items from Cache

So I'm trying to introduce some caching into my Asp.Net application. New data for the user is returned from the DB in the form of large datasets. Whenever a user requests data I insert this dataset into the HttpRunTime.Cache. At the moment I'm setting their caching time to 2-3 hours. And these are really large datasets and I put them in ...

Firing a method in form 1 on click of a button on form2

Hi, I am quite new to windows forms. I would like to know if it is possible to fire a method in form 1 on click of a button in form 2? My form 1 has a combobox. My form 2 has a Save button. What I would like to achieve is: When the user clicks on Save in form 2, I need to check if form 1 is open. If it is open, I want to get the instance...

How to connect a winform to internet through a proxy server

I'm writing a desktop application in C# and .Net 2.0 that consumes webservices and i'm making provision for the case when the app is behind a proxy server, like with the example in this question. It's a great idea and will set my app.config the same way, but right now I want to test the connection by providing the username and password....