.net

Configuration Error - Exception has been thrown by the target of an invocation

I have built a custom membership provider that I have used in a previous asp.net mvc app with no problems. Now I am trying to use it in an asp.net webforms app and I keep getting Configuration Error - Exception has been thrown by the target of an invocation. There is no stack trace on error page and the breakpoint in my membership prov...

Why does generic method with constaint of T: class result in boxing?

Anyone any idea why a generic method which constrains T to class would have boxing instructions in the generates MSIL code? I was quite surprised by this since surely since T is being constrained to a reference type the generated code should not need to perform any boxing. Here is the c# code: protected void SetRefProperty<T>(ref T pr...

Enumerating Application Pools in IIS

Hello, I am wondering if there is a way to enumerate the collection of applications pools (not the applications in a given pool - but the pools themselves) on the local IIS server using ASP.net 3.5 without the use of WMI, and if so can someone provide a link or example to how this is done? (I forgot to add the IIS version is 6.0). ...

Why is there no overload of Interlocked.Add that accepts Doubles as parameters?

I fully appreciate the atomicity that the Threading.Interlocked class provides; I don't understand, though, why the Add function only offers two overloads: one for Integers, another for Longs. Why not Doubles, or any other numeric type for that matter? Clearly, the intended method for changing a Double is CompareExchange; I am GUESSING ...

BackgroundWorker limitation on Windows server 2003

I am currently having an issue with BackgroundWorker running on Windows Server 2003. I have a window application that need to run more than 50 threads. The code I wrote use BackgroundWorker(BW) as a Thread wrapper to update data onto a window form. The issue is that the code are able to run more than 50 BWs on my XP machine, but stop at...

What are the key differences between Dictionary.clear and new Dictionary() in C#?

Which one is recommended for which cases? ...

In .NET, how do I Create a Junction in NTFS, as opposed to a Symlink?

I'm trying to create an NTFS Junction. From the cmd line I can do this using the junction.exe tool from sysinternals. The output of a DIR cmd for a junction looks like this: Volume in drive C has no label. Volume Serial Number is C8BC-2EBD Directory of c:\users\cheeso\Documents 03/22/2009 09:45 PM <JUNCTION> My Music [\?...

'Check for update' component freely available?

Do you know of a freely available (preferable FOSS) implementation of the ubiquitous 'Check (online) for a new version' functionality? .NET is preferred. What would be even more interesting, would be a mechanism to allow the download and install of the update(s) in case they are available. ...

Really weird HTTP client using TcpClient in C#

I am implementing a really simple HTTP Client that just connects to a web server and gets it's default homepage. Here it is and it works nice: using System; using System.Net.Sockets; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { TcpClient tc = new TcpClient(); ...

Problem opening custom config section in web.config

I am having some trouble opening a custom config section in my web.config file. Here is web.config: <configuration> <configSections> <section name="ldapConfiguration" type="GTCC.Ldap.LdapConfiguration,GTCCLdap"/> </configSections> <ldapConfiguration PrimaryServer="1.2.3.4" SecondaryServer="5.6.7.6" Port="636"...

.NET TripleDESCryptoServiceProvider equivalent in Java

Hello nice people, Please, just don't ask me why. I just have this code in .NET that encrypt/decrypt strings of data. I need now to make 'exactly' the same funcionality in java. I have tried several examples for DESede crypt, but none of them gives the same results as this class in .net. I even though on making a .net webserbvice behi...

Is it possible to make "this type" for generics in C#?

Kind of theoretical question. Quite long so feel free to skip if you are not in the mood for theory. Imagine that you have two classes, one inherited from another. The base class is generic and has a method that in the closed type must return some instance of this closed type. Like this (note ??? in text): public class Adapter<T> { ...

Loop through a URL to find the working link.

I am downloading a file from a website and I have the link. But the end part of the link changes to the current month. I need to loop through the link, making changes to the month part of it, and download the file. My first question is how to know if a link has failed, to go to another link? Second ,can you can suggest me a way to loop ...

Access Violation in Marshal.PtrToStructure

I am trying to deserialize a structure, and I'm getting an AV exception in PtrToStructure. The only wrinkle is that this is a variable length structure, so I need to adjust the length before deserializing. Here's my code, is there anything obviously wrong? The structure contains only integer/short/byte arrays, nothing fancy. the incomin...

Use System.Threading.Timer with CustomThreadPool?

So, according to MSDN, System.Threading.Timer calls it's callback delegate on a ThreadPool thread. Is there any way to make it use a custom ThreadPool? (For instance, Jon Skeet's CustomThreadPool.) ...

I am trying to make an obfuscator.

This is kind of a two part question. But it both relates to the same thing. I want to work with the IL code of an app to apply patches. I am wondering what would be the right approach. Obviously I could decompile it and read and edit the il code file then recompile. but is there some way to read it as msil code right in the file. and ma...

Access won't let me see the changes I've made to the database

I've got an MS-Access database stored in a folder (yes, I have 'Modify' permissions set for the folder) on a Vista machine. From my .NET application (VB2008) I can query the database just fine, and add records to the tables. When I re-run the application the added records are there. However if I start Access (2000) and open the databa...

Killing/Aborting a thread with a single, giant task (e.g. SQL Query)

Okay, There seems to be a lot of discussion on here about how terribly awful Thread.Abort() is, and how to work around using Thread.Abort() in your code by adding exit checks in your loop. This assumes that you control how the work is being partitioned in a way that's granular enough to loop over it. But how do I do the following: L...

Getting 0x80070002 error intermittently when trying to instantiate a COM object in classic ASP

We have a classic ASP page that is instantiating a .Net object through a COM interface. It was working fine for a long time, but over the weekend we applied some Windows updates and it is no longer working reliably in our production environment. Sometimes it works, sometimes it doesn't and it seems random when it works. It doesn't fail i...

Checking of List equality in C# .Net not working when using Nhibernate

I seem to be having a problem with checking for list equality. In my case, I have two role objects and I want to see if they are equal. Each role contains a name and a List of permissions. Each permission contains just a name. public class Role : BaseDomain { virtual public String Name { get; set; } virtual public IList...