Life, Surf, Code and everything in between
WebLog Posts in Category .NET
Capturing Performance Counter Data for a Process by Process Id
Saturday @ 3:36am
Process specific Performance Counters in .NET work directly only with Process Names, not Process Ids which can be problematic if you need to monitor performance of multiple instances of the same process. In this post I describe how you can capture multiple processes uniquely and monitor each individually.
A .NET QueryString and Form Data Parser
September 08, 2014 @ 10:28am
.NET is a bit short when it comes to tools that can manipulate UrlEncoded data. If you need to read, create or modify raw querystrings or form data outside of ASP.NET's System.Web context there isn't a clean way to do this and even there if you want to modify url encoded data you'll need to write some code. This article describes a UrlEncodingParser class that lets you read in raw query strings, form data or entire URLs, then lets read, add and update values and then write the values back out. Makes you wonder why that functionality doesn't exist natively somewhere in .NET, eh? Code and samples are provided.
Using FiddlerCore to capture HTTP Requests with .NET
July 29, 2014 @ 2:03am
If you have an application that needs to capture HTTP or monitor HTTP traffic, FiddlerCore is the tool you can use to do it easily. In this post I demonstrate how easy it is to integrate FiddlerCore into an application to capture HTTP requests and save the data, as well as discuss how to deal with configuring FiddlerCore for SSL Certificate installation for HTTPS captures.
Nuget Dependencies and latest Versions
June 19, 2014 @ 5:52pm
NuGet is a great component distribution mechanism and it's awesome for consuming components and getting them into projects. However, creating NuGet packages and getting the version dependencies worked out reliably has been a challenge. Specifically the way dependency versions are pulled in by NuGet are somewhat counterintuitive. In this post I look at some of the issues and bring up some thoughts of how this could work better.
Westwind Application Configuration Updates
April 29, 2014 @ 3:33am
I've recently updated my code-first, class based application configuration library with a number of features and updates. This blog post discusses some of the changes and new features of this useful library.
Using .NET HttpClient to capture partial Responses
January 29, 2014 @ 5:50pm
Recently I needed to create a high volume monitoring application that retrieves a huge number of HTTP requests, and I need to minimize the amount of data pulled from these requests. In this post I describe some of the limitations in actually pulling an exact amount of data from an HTTP and Tcp/IP connection in .NET.
Dynamically loading Assemblies to reduce Runtime Dependencies
November 12, 2013 @ 4:05am
Using a static language like C# tends to work with hard assembly bindings for everything. But what if you want only want to provide an assembly optionally, if the functionality is actually used by the user? In this article I discuss a scenario where dynamic loading and activation made sense for me and show the code required to activate and use components loaded at runtime using Reflection and dynamic in combination.
Fixing a SkyDrive Sync Disaster
June 21, 2013 @ 8:27am
Recently I ran into a major sync problem with SkyDrive, where SkyDrive decided to update my synced folders with older data from the server, overwriting newer local files. After mangling thousands of files I ended up creating a small utility that lets me look and update these files in bulk. This post discusses the issues and provides a utility to facilitate fixing the problem.
Setting up and using Bing Translate API Service for Machine Translation
June 06, 2013 @ 2:52am
Public translation APIs as a Web Service are great for doing machine translation within applications or casual translation for user input in many applications. With Google recently removing Google Translate API I've been looking at alternatives and so wanted to hook up to the still supported Bing Translate API. Unfortunately the signup process for the Translate API is terrible, although using the service is easy enough once signed up. In this post I discuss step by step how to sign up and how to use the Translate API.
A small, intra-app Object to String Serializer
April 01, 2013 @ 2:41am
On a few occasions I've needed a very compact serializer for small and simple, flat object serialization, typically for storage in Cookies or a FormsAuthentication ticket in ASP.NET. XML and JSON serialization are too verbose for those scenarios so a simple property serializer that strings together the values was needed. Originally I did this by hand, but here is a class that automates the process.
Sql Connection Strings in .Config Files vs. Source Control
February 27, 2013 @ 12:18pm
Connection strings in projects under source control can be problematic. Each Source Control user can potentially have different connection settings to use a database connection and these differences can't be easily reconciled via Source Control. Here are a couple of approaches that have worked for me to deal with this issue.
Building a better .NET Application Configuration Class - revisited
December 28, 2012 @ 4:41am
Managing configuration settings is an important part of successful applications. It should be easy to ensure that you can easily access and modify configuration values within your applications. If it's not - well things don't get parameterized as much as they should. In this post I discuss a custom Application Configuration class that makes it super easy to create reusable configuration objects in your applications using a code-first approach and the ability to persist configuration information into various types of configuration stores.
Process.Start() and ShellExecute() fails with URLs on Windows 8
December 12, 2012 @ 8:14pm
It appears that on Windows 8 there's a bug in the ShellExecute() API that causes failure in URL navigation when running under Administrative privileges.
Back to Basics: When does a .NET Assembly Dependency get loaded
November 03, 2012 @ 4:39pm
Assembly loading in .NET is often a cause of confusion. So many times I've heard how evil it is to add a reference to some big assembly, if it's just a minor feature. But .NET is really smart in assembly loading and by default uses just in time loading of referenced assemblies. In this post I review when assemblies are loaded with a few simple examples that demonstrate the process.
A tiny Utility to recycle an IIS Application Pool
October 02, 2012 @ 3:29am
Here's a small console app to recycle an Application Pool which seems to be something I've needed to do repeatedly in the past.
Creating STA COM compatible ASP.NET Applications
September 18, 2012 @ 6:36pm
When it comes to deploying STA COM components in ASP.NET only WebForms has native support for STA component. Other technologies like MVC, ASMX Web Services and WCF run only in MTA mode. If you need to run your STA COM Components in ASP.NET here is what you need to know and a few tools that help you create STA compatible handlers.
Using JSON.NET for dynamic JSON parsing
August 30, 2012 @ 5:04am
Parsing JSON dynamically rather than statically serializing into objects is becoming much more common with today's applications consuming many services of varying complexity. Sometimes you don't need to map an entire API, but only need to parse a few items out of a larger JSON response. Using JSON.NET and JObject,JArray,JValue makes it very easy to dynamically parse and read JSON data at runtime and manipulate it in a variety of different ways. Here's how.
.NET 3.5 Installation Problems in Windows 8
August 27, 2012 @ 3:32pm
I ran into a major headache with getting .NET 3.5 properly on my Windows 8 install - although installed SP1 was missing and wouldn't properly install. Here's what happened, how to check for the version actually installed and how to work around it.
Basic Spatial Data with SQL Server and Entity Framework 5.0
June 21, 2012 @ 7:10am
Spatial data has been available for a while in SQL Server, but if you wanted to use it with Entiry Framework you had to jump through some hoops. In this post I show how basic SQL Spatial data works and then how you can utilize the new features in EF 5.0 to directly access spatial data using your CodeFirst models.
DropDownList and SelectListItem Array Item Updates in MVC
May 16, 2012 @ 9:44am
Ran into an 'interesting' behavior today with a cached list of SelectListItem in drop downlist where the cached list was getting updated by MVCs model binder.
Dynamic JSON Parsing in .NET with JsonValue
March 19, 2012 @ 3:09am
The JsonValue/JsonObject/JsonArray classes in the System.Json are new for the full .NET framework and recently introduced with the various betas of ASP.NET (and previously WCF) Web API. JsonValue fills the need for dynamically parsing and serializing of JSON at runtime.
.NET 4.5 is an in-place replacement for .NET 4.0
March 13, 2012 @ 11:43am
With the betas for .NET 4.5 and Visual Studio 11 and Windows 8 shipping many people will be installing .NET 4.5 and hacking away on it. There are a number of great enhancements that are fairly transparent, bBut it's important to understand what .NET 4.5 actually is in terms of the CLR running on your machine. When .NET 4.5 is installed it effectively replaces .NET 4.0 on the machine. .NET 4.0...
Creating a dynamic, extensible C# Expando Object
February 08, 2012 @ 2:28am
In this post I discuss a custom extensible dynamic type implementation that allows you to extend existing types with dynamic properties at runtime.
Dynamic Types and DynamicObject References in C#
February 01, 2012 @ 2:47am
This post explains the difference between dynamic reference and explicit references of an IDynamicObject implementation and how they behave differently.
Unable to cast transparent proxy to type <type>
January 13, 2012 @ 1:25pm
If you've ever run into the Unable to cast Transparent Proxy to
error, you know how frustrating it can be. Usually this is caused by multiple assemblies causing unexpected load behaviors. Here's what the problem is and how you can check for problems.
XmlWriter and lower ASCII characters
January 02, 2012 @ 2:36am
If you've ever tried to generate an XML document from content that contains lower ASCII characters you might have found out that this will throw exceptions. Here's why this happens and how you can work around the issue in a pinch.
Changing the default HTML Templates to HTML5 in Visual Studio
December 23, 2011 @ 4:19am
The default WebForms templates in Visual Studio still use the XHTML doctype headers by default. HTML5 doctype headers are easier to use and read and with HTML5 support now becoming mainstream and backward compatible with older browsers its time to switch those doctype headers. This post demonstrates how to change the default VS templates or create new templates altogether. With HTML becoming more prominent and the new headers being easier to read and smaller in size, it's
Creating a Dynamic DataReader for easier Property Access
December 06, 2011 @ 5:04am
Custom dynamic types in .NET are great to wrap other data structures into easier to use and cleaner object.property interfaces. In this post I demonstrate how you can create a dynamic DataReader that allows access to a DataReader's fields using plain object.property syntax.
Creating a Dynamic DataRow for easier DataRow Syntax
November 24, 2011 @ 3:13am
The Dynamic Language Runtime features in .NET 4.0 make it very easy to create custom dynamic types that use alternate 'data sources' to expose a new member interface. In this post I describe a simple example that exposes a classic DataRow as a dynamic type to allow cleaner syntax and no need for type casting when accessing DataRow objects.
Dynamically creating a Generic Type at Runtime
November 11, 2011 @ 4:39am
How do you get a type reference to a generic type instance for a specific set of generic type parameters at runtime? Generics is primarily a coding time tool that creates code at compile time. It's not real easy to create generic types at runtime using dynamic type information. In this post I talk about an issue I ran into while trying to create dictionary types on the fly.
An easy way to create Side by Side registrationless COM Manifests with Visual Studio
October 09, 2011 @ 3:58am
Registrationless COM makes it possible to run COM components without registry configuration making for an xCopy deployable solution. The process is not terribly difficult but not easy to debug if something goes wrong. Here's how you can use registrationless COM in your apps.
An Xml Serializable PropertyBag Dictionary Class for .NET
September 27, 2011 @ 4:50am
.NET includes many Dictionary related types but serialization of Dictionaries leaves a lot to be desired. In this post I show how to create a serializable PropertyBag class that makes it easy to XmlSerialize arbitrary key/value pairs into XML and back.
Show raw Text Code from a URL with CodePaste.NET
September 23, 2011 @ 6:44pm
CodePaste.NET has been around for a while now. But did you know that you can also use it to syntax color code from the Web simply by providing a URL and language? Here's how.
Opening the Internet Settings Dialog and using Windows Default Network Settings via Code
July 20, 2011 @ 12:02am
Most applications that need to use HTTP to go online require some sort of HTTP configuration options to allow for custom network configurations. An easy way to do this is to rely on the default connection settings that Windows provides. Here's how to use the Windows network settings and how to bring them up visually for editing programmatically.
COM ByteArray and Dynamic type issues in .NET
July 18, 2011 @ 1:36am
Ran into an interesting issue today with binary data passed from COM to .NET via a dynamic instance. The result was rather unexpected with dynamic failing to properly cast the binary to byte or even a basic object instance.
Getting the innermost .NET Exception
July 01, 2011 @ 12:32am
In some cases when exceptions are thrown, the innermost exception is what holds the most important information. For example, dynamic method calls via Reflection or dynamic invocation. Here's a simple funciont that is useful for easily retrieving the innermost exception.
Web Browser Control – Specifying the IE Version
May 21, 2011 @ 12:06am
The Microsoft Web Browser control's default rendering mode is not standards compliant - it's stuck in IE 7 quirks mode even on systems that run a later version of IE such as IE 11. This produces terrible results if you're attempting to use HTML 5 or or CSS 3 markup in your HTML to display. However, the Web Browser control does support using specific versions of Internet Explorer via some registry values that can be set for a specific application. This post shows how to configure your application to work with a specific version of Internet Explorer's rendering engine.
Loading Assemblies off Network Drives
March 22, 2011 @ 4:24pm
Remote loading of assemblies and CAS policy in .NET have always been hassle and although .NET 4.0 improves security, lightning up rules to be on par with Win32 applications, for COM Interop and custom runtime hosting old rules still apply. Luckily there's some help in the form of a new configuration switch that allows overriding remote loading of assemblies.
HttpWebRequest and Ignoring SSL Certificate Errors
February 11, 2011 @ 5:14am
Man I can't believe this. I'm still mucking around with OFX servers and it drives me absolutely crazy how some these servers are just so unbelievably misconfigured. I've recently hit three different 3 major brokerages which fail HTTP validation with bad or corrupt certificates at least according to...
CLR Version issues with CorBindRuntimeEx
January 14, 2011 @ 12:45pm
I’m working on an older FoxPro application that’s using .NET Interop and this app loads its own copy of the .NET runtime through some of our own tools (wwDotNetBridge). This all works fine and it’s fairly straightforward to load and host the runtime and then make calls against it. I’m writing this up for myself mostly because I’ve been bitten by these issues repeatedly and spend 15 minutes each...
Hosting the Razor Engine for Templating in Non-Web Applications
December 27, 2010 @ 8:16pm
In this article I describe a set of classes that provide a wrapper around the Razor View Engine so you can use it easily in your own applications to provide templating functionality.
Finding a Relative Path in .NET
December 20, 2010 @ 6:17pm
Here’s a nice and simple path utility that I’ve needed in a number of applications: I need to find a relative path based on a base path. So if I’m working in a folder called c:\temp\templates\ and I want to find a relative path for c:\temp\templates\subdir\test.txt I want to receive back subdir\test.txt. Or if I pass c:\ I want to get back ..\..\ – in other words always return a non-hardcoded...
The dynamic Type in C# Simplifies COM Member Access from Visual FoxPro
September 13, 2010 @ 4:25pm
The addition of the new dynamic typing in the .NET runtime greatly simplifies COM Interop when passing FoxPro objects to .NET. Dynamic types remove the need to use explicit Reflection on dynamically generated FoxPro types that are returned over COM interop and so reduce code complexity and produce more natural and readable code removing one of the annoyances in FoxPro and .NET COM Interop.
.NET WebRequest.PreAuthenticate – not quite what it sounds like
February 18, 2010 @ 1:38pm
On a few occasions I've dealt with Web Services that use - yuk - Basic Authentication and require pre-authentication on the very first request to the server with the server first sending a challenge. This is unusal for HTTP authentication which typically requires a challenge first and then a response with the auth information in the header. The latter approach is what the .NET client components produce by default. PreAuthenticate unfortunately is not quite true to its name and in order to provide true pre-authentication on the first request manual header manipulation is required.
SmtpClient and Locked File Attachments
December 18, 2009 @ 3:00pm
Ran into an easily overlooked problem a few days ago where SmtpClient messages with attachments would keep the attached files locked on the local machine. Email would send fine with attachments but the local files remain locked after sending. It's easy to miss as the files are locked for writing only so subsequent read operations actually work, but the file is still locked. The solution is easy enough by applying a .Dispose() in the right spot, but nonetheless unexpected.
Generic Types and Inheritance
August 18, 2009 @ 11:20am
Although I use Generics extensively, every once in a while it still throws me for a loop when dealing with complex generic parameters and inheritance. In this post I talk about a compilation error I ran into when trying to inherit a generic type including its generic parameters and a way to get around this particular issue.
Simplistic Object Copying in .NET
August 04, 2009 @ 8:04am
Copying object data between instances of objects is something that needs to be done quite frequently yet there are few tools that perform this task well. Here is an admittedly simplistic routine that I nevertheless find useful in many situations.
Changing Configuration Settings in a Desktop Client Application
June 28, 2009 @ 10:28pm
Got a question in response to a Localization article today that asked how to store requested culture settings. In the article I recommend that easiest and most reliable way to switch cultures is to assign the culture when the application runs and allow the user to change cultures somewhere in the UI. When the culture is changed it’s up to the application to decide how to handle the actual culture...
Html and Uri String Encoding without System.Web
February 05, 2009 @ 5:17am
Url and Html encoding/decoding is provided on the HttpUtility class in System.Web but in non-Web applications it's not a good idea to force a reference to System.Web into a client project. Here are a few thoughts on alternatives you can use.
Assembly Loading across AppDomains
January 19, 2009 @ 2:53am
Every time I need to load .NET assemblies from a non-default path in an application I end up spending quite a bit of time trying to get it right. Today was no different: I had a situation where I needed to create a type in a seperate AppDomain based on a dynamically generated assembly that might live in a directory other than the application’s base path. This is sort of like a perfect storm of...
Monitoring HTTP Output with Fiddler in .NET HTTP Clients and WCF Proxies
January 14, 2009 @ 12:36am
Http debugging is immensely useful and Fiddler is a nice tool that provides many options and an easy to use interface to monitor HTTP requests to get maximum information about each request. In order to monitor requests of .NET clients like WebClient, HttpWebRequest or WCF or Web Service proxies you need a little additional configuration to get Fiddler to monitor these requests.
December 19, 2008 @ 2:51am
One thing I do quite frequently in applications is parsing strings and a common scenario requires extracting a string from within another string with delimiters. Here's a small utility function out of my StringUtils library that provides this functionality easily.
September 27, 2008 @ 4:37pm
If you're using the Web Browser Control or the Internet.Application Shell object, you might need to call Javacript t code inside the pages loaded in the browser to manipulate the page from say a WinForms app that interacts with the Web Browser control. Some things are just much easier to do with client side script code and being able to initiate this code from .NET can be very useful. This entry describes how you can access the DOM to call script functions both in .NET and FoxPro.
Variable Scoping in Anonymous Delegates in C#
April 26, 2008 @ 6:24pm
Byte Order Marks and XmlDocument Streaming to HTTP
April 15, 2008 @ 5:32pm
If you're generating XML content that gets sent out to HTTP you'll need to watch out for the default XmlTextWriter encoding which includes a byte order mark. Including a BOM in Http output effectively produces invalid XML and while a smart XML client will skip over the BOM, others will barf on the BOM and treat it as content.
Dynamic Queries and LINQ Expressions
April 14, 2008 @ 12:58am
Using LINQ to SQL in some scenarios where dynamic expresions are required on the right side of a LINQ query expression can be tricky. How do you for example allow a query to use a dynamic field in a query and then query its data? Due to the strong typed nature of LINQ direct LINQ syntax can't be used for this sort of query, but there are a several ways to work around this by using dynamic expressions.
LINQ to SQL ObjectTrackingEnabled and Deferred Loading of Related Data
April 12, 2008 @ 3:28pm
LINQ to SQL supports object tracking by default, but if running queries it's often more efficient to turn off object tracking. This can be done with ObjectTrackingEnabled, but unfortunately this option has a rather severe side effect on deferred object loading.
.NET 3.5 Framework Distribution Size
March 27, 2008 @ 1:23am
One of the considerations of whether to choose .NET 3.5 for your non-server applications might be distribution size. If you're building a vertical application that you're distributing over the Internet you are probably concerned about the size of your installation if you want people to download it. Recent versions of the .NET runtime have a made decidedly nasty turn for the worse when it comes to...
LINQifying - getting rid of CollectionBase?
March 26, 2008 @ 1:57am
If you're sitting on some old types that implement CollectionBase you might find that they don't directly work with LINQ. Here's how you can make these types work with LINQ.
Book Review: LINQ in Action
March 21, 2008 @ 5:36am
Just got done reading LINQ in Action and it's an excellent read. Rarely do I read books cover to cover, but this book definitely made me want to go through the whole thing as it's full of little gems of information, things I didn't know and lots of new ideas I can hopefully apply soon.
MS Tests failing due to Security Errors
March 17, 2008 @ 12:53pm
Ran into an odd problem today while testing with a third party DLL. My unit tests failed to run complaining that the third party DLL was not trusted. Turns out the problem is related to the security tags applied to the file when it was downloaded and installed directly of a Web download.
Odd string.Replace Chaining Behavior
March 05, 2008 @ 2:05am
I ran into a bit of a head scratcher today with a routine that does some string manipulation. It's an old routine that I use to help me do the equivalent of ResolveUrl() outside of the context of the ASP.NET Page framework - typically in static code somewhere or as part of a handler or other component. The process is easy enough but I ran into a snag with the special case of resolving a root web...
Watch out for XmlDocument.PreserveWhitespace when dealing with Digital Signatures
March 03, 2008 @ 12:42pm
When creating digital signatures of XML documents its crucial that the Xml document settings on signing match the document settings that are expected for validating signatures. I ran into a problem where our signatures were failing with a vendor's site, due to the PreserveWhitespace property settings on our end and on the vendor's parser being mismatched.
Digitally Signing an XML Document and Verifying the Signature
February 23, 2008 @ 3:41am
Signing an XML document and then validating the digital signature of the document doesn't involve a lot of code - once you know how it works, but arriving there is quite the journey. This post describes setting up a certifcate for testing, signing an XML document with the Private key and then validating it with the Public key.
SmtpClient in Medium Trust
January 18, 2008 @ 6:13pm
SmptClient is supposed to work in Medium trust and it in fact does work, but only if you use Port 25. I ran into an unexpected failure while connecting to my ISP who requires an alternate port for SMTP access outside of their network.
Griping about System.Net.Email.SmptClient/MailMessage
January 14, 2008 @ 11:07am
For many years I've been using a home built SMTP client I built using low level Sockets. Single class, set a few properties and it goes off and sends emails. With about 5 lines of code I can be off sending an email from just about any app Web or otherwise. I created the custom class originally to...
Accepting invalid Certificates for WCF/Web Services/HttpWebRequest gets easier
December 12, 2007 @ 2:37am
Looks like .NET 3.0/3.5 has updated functionality to allow setting certificate certificate polices. In fact I noticed that the old mechanism I showed in an earlier post has been marked as obsolete, but there's a nicer replacement mechanism available now. I frequently use Certificate policy to...
Detecting Text Encoding for StreamReader
November 28, 2007 @ 1:04am
Reading Text files with proper encoding and byte order marks can be a bit of a pain when using a StreamReader as there's no detection of no byte order mark that defaults to UTF-8 which is usually incorrect. Here are a few thoughts on explicitly detecting BOM settings and getting a corresponding Encoding.
A few C# Time Utilities for Fractional Time Values
September 24, 2007 @ 11:34pm
I found myself working with displaying time values a bit today for a demo app I'm building that needs to display elapsed time values in a meaningful way. There's display, but also storage of total values in a rounded fashion. Here are couple of routines that helped make short work of the time values.
Reflection, GetMember() and COM Objects?
September 17, 2007 @ 12:32am
I'm working on an old app that interfaces with a legacy COM object. In reviewing some of my wwDataBinder code I noticed that it didn't work against COM objects for databinding. With a few minor changes I've been able to make the binding code work by using the the higher level Type.InvokeMember...
Back to Basics: .NET Framework 2.0 Book
September 08, 2007 @ 12:59pm
Every once in a while I feel I need to review the basics of CLR development because frankly I'm not smart enough to keep it all in my head at once and over time the not so frequently used functionality kind of starts getting a little foggy. So from time to time I pick up a core CLR/Language book...
Dynamic Type Invokation in .NET
August 30, 2007 @ 4:01am
There many ways to dynamically instantiating types in .NET and while it's not a common task when you need it you might find that there are a lot of different ways that you can instanatiate a type. Here's some discussion of different ways you can do it and a few helper functions to make life a bit easier.
XmlWriter and Schema
August 09, 2007 @ 1:16am
In the ResX exporter for my data driven Resource Provider I use a bit of code that iterates over the database resources and then spits out ResX resources from the data as an option to get your resources into your Web site. The code I've used in this stretch of code uses an XmlWriter to quickly spit...
Setting up and running Subversion and Tortoise SVN
August 08, 2007 @ 3:58am
Since I've been working with Subversion a bit recently I thought I'd write up a quick step by step guide to getting started with Subversion and Tortoise SVN. Actually this has had a practical side to it - I have a couple of developers on a project that needed to get a quick start and get...
West Wind Html Help Builder Update
August 08, 2007 @ 2:29am
I've put out an updated version of Help Builder today. Here are a few development perspective comments on this release. Code Pasting This update adds a handful of new features in regards to handling code in topic content. If you've been following my blog you've probably seen some of the...
Generics and COM Interop don't mix
July 10, 2007 @ 1:57am
COM Interop is rarely fun, but it looks like it's getting to be less and less useful as time goes on and new .NET Runtime features come along that don't work well over COM. It appears that Generic types can't be exported over COM and be usable to a client like Visual FoxPro. When I create a class...
Hosting the .NET Runtime in Visual FoxPro
July 01, 2007 @ 1:14pm
Interop with .NET from FoxPro can be accomplished fairly easily by using COM Interop. With COM Interop you can take advantage of .NET's COM Callable Wrapper to wrap up .NET components and make them available as COM objects. I've written extensively about this interaction (here and here)...
HttpWebRequest and GZip Http Responses
June 29, 2007 @ 2:57am
I've talked a bit about GZip compression (here and here and here) on the server recently. It's pretty straight forward to use GZip compression either by letting IIS do it for you automatically or by using some simple ASP.NET code to compress content. As a quick review to create GZip content on...
Hosting a WCF Service in a non-.NET Client
June 15, 2007 @ 11:05pm
I'm still screwing around Web Connection and trying out a quick proof of concept tonight and thought I'd share a few steps on how to host a WCF in a non .NET client via COM Interop client like Visual FoxPro. This article discusses WCF server and client creation in general terms and in addition covers the interop issues to make it work in these clients.
Source Control and Sharing Projects
May 29, 2007 @ 3:23pm
Over the years I've been using source control kind off and on for my personal development. I would really love to use source control all the time but in the past I've had a number of issues in making things work correctly with the way I work on my internal projects. For work I do with...
Fumblings and Thoughts on WPF DataBinding
May 20, 2007 @ 9:08pm
So I spent the evening today experimenting with databinding in WPF. Overall I'm very excited about that data binding capabilities in WPF which finally has produced a powerful and reasonably user friendly way to do data binding of just about any type to anything else. WPF makes this easily available...
DynamicMethod from C# code?
May 13, 2007 @ 10:40pm
I'm experimenting with DynamicMethod in .NET 2.0 in light of all the good things that apparently have come of it especially in light of the recent release of the Dynamic Language Runtime on CodePlex. I haven't dug into that code (I suspect it won't be light reading <s>), but thought it sure...
Forcing an ASP.NET Application to 'stay alive'
May 10, 2007 @ 12:59am
This post in the 'stupid pet tricks' category I suppose - it's not one of the things that you need to do every day, but if you need to run an application that requires that your ASP.NET application stays up and running without the discontinuity of AppDomain or worker process shutdowns this can be...
How many ways to do a String Replace?
April 30, 2007 @ 1:58am
You ever pull this stunt? You're in the middle of working and you realize that you need a string function. .NET makes string manipulation fairly easy but it can often be frustrating to find just the right function. The issue is that .NET string functions are scattered over several different objects....
Blocking IIS IP Addresses with ASP.NET
April 28, 2007 @ 7:37pm
Over the last few months I've had increasing SPAM traffic coming to my site, usually from a few select IP address groups. Most of this site spamming crap that I actually catch tries to simply POST to every possible URL on the site apparently that contains a FORM tag, spewing forth a plethora of...
Overthinking AutoResetEvent in an HttpHandler
April 20, 2007 @ 5:32am
I'm an idiot! I spend almost the entire screwing around with some multi-threading code that was locking up on occasion. As everyone knows debugging multi-threaded code - running inside of ASP.NET no less - is no trivial matter to work with and debug. So I'm rebuilding the Web Connection ISAPI...
C# HRESULT comparison
April 18, 2007 @ 10:31pm
I just had a little brain freeze dealing with HRESULT error from a COMException. When dealing with COM objects you still need to deal with the unfortunate COM idiosyncrasies like HRESULT values which get returned from just about every COM call. COMException exposes this HRESULT as an int value. Now...
WebRequest and SSL Connection Problems
April 17, 2007 @ 1:16am
Ever run into a problem with WebRequest or a Web Service Proxy on an SSL request where the first request works just fine but the second one fails? Run again and it works again and then fails again? It's a common problem that occurs when the Keep-Alives aren't handled the way the client requests on the server.
Generics in CodeDom vs. Generics with Reflection
April 06, 2007 @ 2:46pm
In Help Builder's documentation imports from .NET code I have to manage two sets of interfaces: One that imports data using Reflection which is the more thourough mechanism that goes out, parses types and pulls in XML documentation. Getting Generics to work right in that code took a while to get...
The server committed a protocol violation with WebRequest
March 29, 2007 @ 7:03pm
I've been working with a host of different OFX financial services to retrieve data from remote servers and merge them into one of my client's systems. These servers are a wide variety of different Web Servers and using various versions of the OFX protocols which has been nothing short of a...
Building a SnagIt Screen Capture Plugin for Live Writer
March 19, 2007 @ 12:35am
I spent a few hours a couple of days ago creating a plugin for Windows Live Writer that allows for easy screen captures. I've long been a huge fan of SnagIt from Techsmith and since SnagIt's capture functionality is available as a COM interface it's quite easy to expose the functionality in other...
February 14, 2007 @ 12:10am
Field Value not setting...
February 07, 2007 @ 12:56am
I've run into an odd problem that I can't figure out. Maybe I'm just missing something obvious but I have a situation where a field value simply will not set. No error, no failure, but the value assigned simply is ignored.
More on GZip compression with ASP.NET Content
February 05, 2007 @ 4:53pm
Now that GZip is natively available in .NET 2.0 it's very easy to compress your ASP.NET content with GZip compression.
XmlWriter, Strings and Byte Order Marks
February 04, 2007 @ 2:07am
When using an XmlWriter to generate output to anything but files you'll want to be careful of the Byte Order Marks that get generated by default.
Bugged by a Serialization Assembly
February 01, 2007 @ 2:27am
I ran into a problem with a type that wouldn't serialize properly because - gulp - of a bad DefaultValue attribute value. It's not a good feelign to have the XmlSerializer fail, but there's a way to actually debug this.
Terminal Server Awareness
December 28, 2006 @ 1:42am
Today I needed to differentiate some code that runs a stock windows interface or running under Terminal Services as the UI presented would look horrible and stutter badly under TS. Here's a quick code snippet that demonstrates how to check for Terminal Server and branch if necessary.
Reflection on Problem Assemblies
December 22, 2006 @ 10:00pm
I ran into a problem today in Help Builder where a bad assembly reference was causing problems with importing type information properly. Here are a few thoughts and a question to see if there are alternatives for type parsing.
Expanding Urls with RegEx in .NET
December 21, 2006 @ 6:42pm
I frequently need to parse and auto-expand URLs inside of user input. Here's the routine I use to do this.
CLR Data Performance Counter Failures
November 19, 2006 @ 4:23am
So I’m revisiting my performance counters that I run on my Web site that provide some rudimentary performance monitoring for my site. It’s useful to keep track of the number of open SQL Connections, number of pooled connections in the CLR pool, StateServer Sessions and a few other things. I’ve...
Rounding down a Date in SQL
November 15, 2006 @ 2:36pm
Dates in .NET are always represented as DateTime values which include a time portion. Sometimes I need to use dates that are ‘just’ date values and there’s no native mechanism to extract just the date as far as I can see.
September, 2014 (2)
August, 2014 (1)
July, 2014 (2)
June, 2014 (4)
May, 2014 (3)
April, 2014 (1)
March, 2014 (2)
February, 2014 (2)
January, 2014 (3)
December, 2013 (4)
November, 2013 (5)
October, 2013 (4)
September, 2013 (3)
August, 2013 (2)
July, 2013 (3)
June, 2013 (4)
May, 2013 (2)
April, 2013 (5)
March, 2013 (4)
February, 2013 (2)
December, 2012 (2)
November, 2012 (7)
October, 2012 (3)
September, 2012 (3)
Visual Studio (37)
Web Services (17)
Web Api (16)
Microsoft AJAX (8)
Sql Server (7)
Web Connection (7)
West Wind Ajax Toolkit (7)
Live Writer (5)
Html Help Builder (5)
Visual Studio (4)
Entity Framework (4)
Source Control (4)
Software Development (3)
Help Builder (3)
Internet Explorer (2)
Web Deployment Projects (1)
Web Design (1)
Control Development (1)
Dynamic Types (1)
© Rick Strahl, West Wind Technologies, 2005 - 2014