.net

Clear the .Net downloaded application cache without mage.exe?

I have a .Net application that I distribute using ClickOnce and I make available online only. How do I clear the download cache from a users machine that doesn't have Visual Studio installed? ...

Is BackgroundWorker suitable for long-running operation?

any idea suggestion about BGW for long-running operation? ...

BackgroundWorker is cool, but only report progress

It will be cooler, if BGW can report more than just progress, such as status, etc, any better alternative/workaround if i want more than just progress? ...

How to extract the private key from an snk file

Hello. I am trying to have my application (C# under .NET 3.51 SP1) recognize that a file has come from a "safe" source. My approach was I would sign the application and then, at a later date, I would use the private key from the same snk file to sign files. The application would use the public key (easily obtainable) and calculate if t...

Does WCF Data Services return invalid JSON?

I'm upgrading an application that was using jQuery 1.3.2 to consume a WCF Data Service (a.k.a. ADO.NET Data Services, a.k.a. Astoria) to use the latest version of jQuery (1.4.2). My application is now failing, with JSON parsing errors, because jQuery 1.4 now uses stricter JSON parsing. I've run the JSON returned by my data service throu...

The right way to send email from Windows service

Hi, I need to send lots of emails(probably hundreds a day) on schedule base. The way I'm thinking to do it is as follows but the problem is that my Body field can get very big, and if i add it as string it gets ugly. SmtpClient client = new SmtpClient(); //host and port picked from web.config client.EnableSsl = true; ...

Which ui framework to select

In a windows/.net environment I currently use castle monorails with jquery to provide an administrative interface to an e-commerce application. This application works nicely, but has no real concept of ui composition. Up to now this has not been a problem, because the ui was targeted to a single user base, and a single domain object. Th...

Linq To Objects Outer Join

Hi, Im trying to use LINQ to query Objets. I'm doing the following: Dim myList As Generic.List(Of MyItem) = (From ThisItem In LinqToSqlObject.Items _ Join Folder In LinqToSqlObject.Folders _ On Folder.Id Equals Item.Id _ ...

Nested types that are public

Hi, I'm curious as to what is good practice when it comes to certain scenarios involving nested types in .NET. Lets say you have a Wheel class, and the Wheel class holds Bearing objects. A Bearing object only makes sense within a Wheel and you do not want to allow it to be created independently, so it would make sense to have the Bear...

Limit the cpu usage of a windows .NET service

Hi all, is there any way to throttle the cpu usage of a windows service that is written in .NET, either inside the service code or outside. Setting the current thread to the lowest priority is not an option but as soon as exceptions start to occur the cpu load goes up, is it possible to limit this? thx in advance, greetings ...

DPAPI + Entropy

We have a WPF app that allows our users to download encrypted content and we want to provide the ability to decrypt this content off-line. The idea is to download the keys and store them using the DPAPI but I'm having trouble with the entropy parameter. Is there any way to generate an entropy to consistently use for the DPAPI functions ...

How do performance counter average timers get associated with their base?

I am adding some performance counters to my c# project and am creating a new PerformanceCounterCategory. In this category, I would like to have multiple counters/timers that track different things. I have a need to use multiple average timers and am trying to understand how the AverageBase counter gets associated with the correct Average...

Top 3 reasons not to develop a "blog system" that generates aspx files on the fly.

In this question the OP implies that he wants to base the blog system he is developing on automatic creation of .aspx files, one for each new blog entry. In my answer to his question (which is related to something else), I told him that I would discourage him from using such an approach, but without giving any real reasons. He is now wan...

Working with .net Combo Boxes

I have a form which has a Combo Box Control. I have selected the drop down style property to DropDown. I have also set the DropDown Width to 250. I have set the auto complete mode to suggest and the auto complete source to listitems. it works absolutely fine when i click on the drop down. but when i type in somethin, the auto complete m...

Are there any StatusNet toolkits for .NET?

There are plenty of projects out there that assist developers in posting things to Twitter; the one I can think of off the top of my head is Twitterizer. Are there any projects for posting to StatusNet? Given that StatusNet implements an API very similar to Twitter, I could probably modify/extend Twitterizer to do just that. However, ...

Save or output WebBrowser object context to .pdf file in VB.NET

I am loading an html page into a WebBrowser object in a VB.NET Windows Forms application. The user may make changes to textboxes, dropdowns, etc. on the HTML page displayed in the browser. I want the ability to save the current context to a .pdf file on the local HD. I am able to print using WebBrowser.Print(), which shows the current...

How do you modify a control that has been re-parented to a TabPage?

I have a user control that contains a collection of controls to be reused for presenting data on the UI. I've attempted implementing a "pop-out" option that will re-parent the control from another container on the form (a Panel, for example), create a new tab page, and then add the control to the tab page. Unfortunately, when the contr...

Read pixel data from an image file in .NET

I am trying to read in the pixel data from an image file as a byte[], for in-memory storage. (The byte array will later be fed to a bitmap image object, but I want the data in memory so that there's no I/O holdup.) This is what I'm currently doing: private byte[] GetImageBytes(Uri imageUri) { //arraySize and stride previously de...

Should I use a Dictionary for collections with 10 items or less, or is there a better alternative?

I have a list of objects and I need to find an object as quickly as possible (by it's name property). What data-structure should I use? I know I can use a Dictionary, but there wont ever be more than 10 items in the list, and if I remember correctly the dictionary is implemented as an array if the collection contains 10 items or less. T...

"Invalid class string" while trying to execute DTS Package in VB .NET

I have a DTS package that runs on our MS SQL Server 2000 database server, and need a way for users to execute it from their own machines. (The package creates files that are then transferred by my application to the client machine.) I have included the "Microsoft DTSPackage Object Library" COM reference in the application, but still ge...