.net

.NET Timers: Whats is the best way to be notified in X seconds?

Suppose I have a non-recurring event that needs to be raised X seconds from now such as a timeout. Intuitively it would make sense to create a System.Timers.Timer, set its interval to X*1000, wire its tick up to the event and start it. Since this is a non-recurring event and you only want it raised once you would then have to stop the ...

Tool Comparison: Visual Assist X and Resharper

Hi .Net developers out there! Need your opinion here! I am now using Visual Assist X, a decent piece of software, indeed. But the .Net bloggers seem to prefer Resharper more. I might want to consider a switch over, but before that I want your guys opinion first. ...

What is the impact of having namespaces in multiple DLLs?

I've inherited a VB.net project that generates 2 DLLS: one for the web app, and another for the "business layer". This is for a sub-app of a larger web site. (Using VS2005). The problem is that that something doesn't smell right with the DLL & namespace structure, and I'd like to know if there are any performance impacts. The main web...

Why does my .NET application crash when run from a network drive?

My .NET application fails when run from a network drive even when the very same executable runs perfectly fine from a local hard drive? I tried checking for "Full trust" like so: try { // Demand full trust permissions PermissionSet fullTrust = new PermissionSet( PermissionState.Unrestricted ); fullTrust.Demand(); // Pe...

Is the DLR going to be capable of compiling client-side code?

Is the DLR intended to be used to compile code exclusively prior to distribution or will it potentially be used to compile client-side Javascript in a JIT fashion? ...

Which Dependency Injection Tool Should I Use?

I am thinking about using Microsoft Unity for my Dependency Injection tool in our User Interface. Our Middle Tier already uses Castle Windsor, but I am thinking I should stick with Microsoft. Does anyone have any thoughts about what the best Dependency Injection tool is? Autofac Castle MicroKernel/Windsor ObjectBuilder PicoContainer...

Changing/Adding controls to the windows Open/Save common dialog

Is there a way of changing/adding to the windows Open/Save common dialog to add extra functionality? At work we have an area on a server with hundreds of 'jobfolders'- just ordinary windows folders created/managed automatically by the database application to house information about a job (emails/scanned faxes/Word docs/Spreadsheets/Phot...

Request.UrlReferrer null!?

In an aspx C#.NET page (I am running framework v3.5), I need to know where the user came from since they cannot view pages without logging in. If I have page 'A' (the page the user wants to view) redirect to page 'B' (the login page), the Request.UrlReferrer object is null. Background: If a user isn't logged in, I redirect to the Log...

Determining available bandwidth

What is the best way to determine available bandwidth in .NET? We have users that access business applications from various remote access points, wired and wireless and at times the bandwidth can be very low based on where the user is. When the applications appear to be running slow, the issue could be due to low bandwidth and not some...

HTTP Authentication in .NET

Is it possible to create a .NET equivalent to the following code? <?php if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; exit; } else { echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>"; ...

Compact Framework DirectShow Based Camera with Preview

I've an example (wimobot.org) of a working directshow camera (not based on CameraDialog), but this example doesn't includes preview. I don't know how to implement the direct show filter for the preview, any sample code in C# or Visual Basic .Net? Thanks in advance ...

How to generate Code39 barcodes in vb.net

I want to create Code39 encoded barcodes from my application. I know I can use a font for this, but I'd prefer not to as I'd have to register the font on the server and I've had some pretty bad experiences with that. An example of what I've produced after asking this question is in the answers ...

How do I execute conditional logic based upon the type passed to a VB.NET generic method

I want to create a VB.NET generic factory method that creates instances of classes (as a home-grown inversion of control container). If I pass the interface IDoSomething as the generic parameter, I want to return an instance of DoSomething (that implements IDoSomething). I cannot figure out the syntax of the if statement. I want to wr...

Pascal casing or Camel Casing for C# code?

I've been arguing with my coworkers about Pascal casing (upper camel case) vs. lower CamelCasing. They are used to lower camel casing for everything from table names in SQL databases to property naming in C# code but I like Pascal casing better, lower camel casing for variables and Pascal casing for properties: string firstName; public ...

"Submit" button works in Firefox 3 but not in IE7 (ASP 1.1)

I have code from an old website that I needed to modify. There are two pages that I modified some form code in. I modified the max length of a textbox and I modified slightly a line or two of code in a function. The "btnSubmit_Click" function as it happens. With the new code FTPed up on the webserver, when I click on the "Submit" button...

What is StringBuilder's RAM consumption like?

We have a few operations where we are doing a large number of large string concatenations, and have recently encountered an out of memory exception. Unfortunately, debugging the code is not an option, as this is occurring at a customer site. So, before looking into a overhaul of our code, I would like to ask: what is the RAM consumpt...

How can I write .NET unit tests?

How do I write unit tests in .NET? Specifically Visual Studio 2005? ...

pitfalls/gotchas of click-once/smart-client deployment in .NET

I have several .NET WinForms applications that I'm preparing to convert into a click-once/smart-client deployment scenario. I've read the isn't-this-great tutorials but want to ask if there are pitfalls or "gotchas" that I should be aware of. there are several minor apps used off and on, but the main app is in C#, runs 24/7, is quite la...

.NET Log Soap Request on Client

I'm consuming a third party .NET WebService in my client application. For debugging purposes I want to capture the SOAP requests that are being sent from my server. How would I go about doing this? This is being done on .NET 2.0 without the use of WCF or WSE. ...

How do I persist a ByRef variable into .net winforms dialog form?

I am creating a "department picker" form that is going to serve as a modal popup form with many of my "primary" forms of a Winforms application. Ideally the user is going to click on an icon next to a text box that will pop up the form, they will select the department they need, and when they click OK, the dialog will close and I will ha...