.net

vb

Is DoEvents Evil?

It’s an old VB developer trick, but it also works quite well in .NET: to present responsive WinForms interfaces, do most of your heavy lifting in the first Paint event, rather than in the Load event. I’ve seen many naive WinForm developers perform database queries and other heavyweight

By Jeff Atwood ·
Comments

.net

Custom AssemblyInfo Attributes

To complement my previous post bemoaning the lack of respect for AssemblyInfo, I wanted to illustrate just how easy it is to add a few custom attributes to our AssemblyInfo file: Imports System Imports System.Reflection <Assembly: AssemblyTitle("ASPUnhandledException")> <Assembly: AssemblyDescription("ASP.NET unhandled

By Jeff Atwood ·
Comments

c#

Populate your AssemblyInfo

All too often, I download sample code with AssemblyInfo files that look like this: // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("

By Jeff Atwood ·
Comments

.net

Process.Start and Impersonation

Did you know that Process.Start always uses the security context of the parent ASP.NET process? I just found this out the hard way; Using Process.Start on “whoami.exe” always returns the ASPNET worker process no matter what I do. Some searching turned up this entry in Scott’

By Jeff Atwood ·
Comments

j2ee

Rebuttal Rebuttal

You may remember TMC’s recent comparison of J2EE and .NET. Predictably, there was an IBM rebuttal to the study. Now there’s a Microsoft rebuttal to the rebuttal, which contains comments from both Microsoft and IBM. It’s interesting reading: IBM: The Middleware Company’s WebSphere J2EE programmers failed

By Jeff Atwood ·
Comments

exception handling

Creating More Exceptional Exceptions

I find myself throwing plain old System.Exception far too often. If only I had a complete reference of the many default Exception classes Microsoft provides, like the one Chris Sully provides in his article. That’s good as a starting point, but I don’t see things like System.

By Jeff Atwood ·
Comments

.net

Throwing Better .NET Exceptions with SOAP and HTTP

In a recent entry,  I bemoaned the lack of good global error handling options for .NET Web Services. By “good” I mean “easy,” like the Application_Error event in Global.asax for ASP.NET websites. I have a pretty solid web-oriented generic unhandled exception class, which is documented in my

By Jeff Atwood ·
Comments

.net

I want my WSH.NET!

Speaking of ghetto languages, when exactly is the Windows Script Host going to be updated with a modern language – like, say, .NET? I want my WSH.NET! I still use WSH to write quick and dirty command line utilities that don’t justify a full blown .NET console executable. Like

By Jeff Atwood ·
Comments

.net

SquishySyntaxHighlighter and CRC32

For quick and dirty HTML syntax highlighting, have you tried the Squishy Syntax Highlighter? By way of demo, here’s a little CRC32 routine I scavenged last year. Update 3/05: I am using client-side JavaScript highlighting. I noticed that VS.NET automatically translates the IDE highlighting into the RtfTextBox

By Jeff Atwood ·
Comments

.net

Saving URLs to MHTML via .NET

I just posted another CodeProject article, Convert any URL to a MHTML archive using native .NET code. The title is a bit misleading; using my class, you can actually convert any URL to one of four formats in a single line of code: * Web Page, complete (HTML plus files in

By Jeff Atwood ·
Comments

java

Java vs. .NET RegEx performance

I was intrigued when I saw a cryptic reference to “the lackluster RegEx performance in .NET 1.1” on Don Park’s blog. Don referred me to this page, which displays some really crazy benchmark results from a Java regex test class – calling C#’s regex support “20 times slower

By Jeff Atwood ·
Comments

c#

Net.WebClient and GZip

The Net.WebClient class doesn’t support HTTP compression, e.g., when you add the Accept-Encoding: gzip,deflate header to your request: Dim wc As New Net.WebClient '-- google will not gzip the content if the User-Agent header is missing! wc.Headers.Add("User-Agent", strHttpUserAgent) wc.

By Jeff Atwood ·
Comments