Rick Strahl's Web Log
Wind, waves, code and everything in between...
WebLog Posts in Category ASP.NET
September, 2016 (4)
August, 2016 (1)
July, 2016 (1)
June, 2016 (6)
May, 2016 (6)
April, 2016 (4)
March, 2016 (3)
February, 2016 (2)
January, 2016 (5)
December, 2015 (1)
November, 2015 (3)
October, 2015 (1)
September, 2015 (2)
August, 2015 (2)
July, 2015 (5)
June, 2015 (5)
May, 2015 (5)
April, 2015 (3)
March, 2015 (5)
February, 2015 (4)
January, 2015 (5)
December, 2014 (3)
November, 2014 (2)
October, 2014 (3)
Visual Studio (40)
Web Services (18)
Web Api (16)
Sql Server (8)
Microsoft AJAX (8)
Web Connection (7)
West Wind Ajax Toolkit (7)
Entity Framework (6)
ASP.NET Core (6)
Html Help Builder (5)
Live Writer (5)
Source Control (4)
Visual Studio (4)
Help Builder (3)
Software Development (3)
Internet Explorer (2)
ASP.NET vNext (2)
Web Browser Control (1)
Web Deployment Projects (1)
Web Design (1)
Dynamic Types (1)
Control Development (1)
ASP.NET Core and CORS Gotchas
Monday - Hood River, Oregon
CORS is a requirement for cross domain XHR calls, and when you use Angular 2.0 default dev server and talk to an ASP.NET Core application you'll need to use CORS to get XHR to talk across the domain boundaries. Here's how to set up CORS and how to test it.
First Steps: Exploring .NET Core and ASP.NET Core
June 29, 2016 - Geneva, Switzerland
In this post I'll demonstrate how to get started with .NET Core and ASP.NET using the Command Line Tools. I'll create a few very simple projects and starting with a plain console application, show how to hook up ASP.NET, run an API and MVC app and then run the app locally on Windows and then move it over to run on the Mac. This is not meant to be your typical getting started tutorial that jumps right into Visual Studio and creating a Web project from there. Rather, the purpose of this post is to demonstrate some of the core underpinnings of how .NET Core and ASP.NET Core projects are bootstrapped to run.
ASP.NET Web Site Project Publishing and Changing ACLs
June 28, 2016 - Hood River, OR
When publishing ASP.NET Web Site Projects, the project publish will overwrite server ACLs by clearing them to the inherited defaults and removing rights from common accounts. The result is that if you have custom ACLs set on the server they will be wiped by default. This occurs only on Web Site projects and in this post I remind myself of the .pubxml override setting that disables this default behavior
ASP.NET Core and .NET Core Overview
June 13, 2016 - Hood River, OR
ASP.NET Core and .NET Core are almost here, with the RTM release scheduled for the end of this month. In this post I’m going to revisit the high level overview architecture of .NET Core and ASP.NET Core since so much has changed, to help you understand how the pieces fit together and what it means to develop on the new stack along with some personal thoughts on how I plan to approach all of this new tech in my own work.
Publishing and Running ASP.NET Core Applications with IIS
June 06, 2016 - Hood River, OR
If you plan on hosting ASP.NET Core applications on IIS, you'll find that the process to get your application to run is quite different than it was with classic ASP.NET. Because ASP.NET Core applications are essentially standalone Console applications that run outside of IIS, some special tooling and new publishing tools are required to get your apps up and running on Windows Server. In this post I'll give an overview of the architecture and show you how to deploy your ASP.NET Core applications using IIS on Windows Server.
Strongly Typed Configuration Settings in ASP.NET Core
May 23, 2016 - Maui, HI
ASP.NET Core provides built-in support for using strongly typed classes to represent configuration information. The configuration system provides a flexible mechanism for using different configuration storage providers and mapping those providers to your strongly typed objects. In this post I show how to set up strongly typed resources and use them in your ASP.NET Web applications.
Using Westwind.Globalization to edit loose RESX Files
May 18, 2016 - Maui, HI
Although Westwind.Globalization is primarily aimed at Web applications, you can also use it to edit arbitrary RESX files using the Localization Administration interface that comes with the library. In this post I show how you can import RESX resources, then use the editor to manipulate RESX resources interactively, and then export the resources back out, using a local Web application on your machine.
Configuring ASP.NET and IIS Request Length for POST Data
April 06, 2016 - Maui, HI
One of the most infuriating things about IIS configuration in general is how the Request length is configured in the IIS and ASP.NET. There are several places that control how much content you can send to the server and over the years this setting has changed in a number of ways. The places where it's configured is not super obvious and they can be fluid because some of these features are...
Upgrading ASP.NET 5 Projects between Beta Versions
August 11, 2015 - Hood River, OR
Upgrading ASP.NET 5 projects from beta to beta has not been pretty. The beta 6 update has been one of the easier ones to work through, but still there's a process involved. In this post I describe the steps I tend to go through for each new beta release.
Using and Debugging External Source Code Packages in ASP.NET 5
June 09, 2015 - Hood River, OR
ASP.NET 5 and the new DNX runtime make it very easy to include external source code based packages into your own projects. It super easy to pull a project - including Microsoft's core DNX runtime projects, from GitHub and then link it into your own projects. This is great for debugging and fixing an immediate problem that might be a show stopper for you, or makes it very easy to contribute back to an open source library. In this post I'll describe a debug scenario I ran into in my last post involving a bug in the DNX runtimes, and show how to download and link the library from Microsoft's GitHub repository, fix the bug and integrate the code into my own project.
Strongly typed AppSettings Configuration in ASP.NET 5
June 03, 2015 - Hood River, OR
ASP.NET 5 features a new configuration system that includes a number of new configuration sources as well as an easy way to consume strongly typed resources. In this post I demonstrate how to use the basic features and show how you can use different configuration stores to hold configuration data.
Right To Left (RTL) Text Display in Angular and ASP.NET
May 23, 2015 - Hood River, OR
Recently I was gently asked to add support for RTL language editing in my Westwind.Globalization library and the Web Resource Editor. The Editor supports displaying resources in all of its localized version, but it didn't respect the RTL setting for languages that required it. In this post I describe how RTL support works in browsers, how you can detect RTL support on a locale in .NET and demonstrate how I integrated basic RTL edit and display support for the Resource Editor using a custom Angular directive.
401 Response from ASP.NET Identity when linking to External Accounts
May 05, 2015 - Hood River, OR
A couple of days ago I ran into an odd problem where all of my external ASP.NET Identity providers would fail to redirect to the external provider login URLs. Instead the app fired empty 401 requests without any other indication of failure. It turns out this was a misconfiguration issue, but it took a bit to track this down due to the fact that there's no error trapping and no error information. Here's more info on this edge case failure.
ASP.NET MVC, Localization and Westwind.Globalization for Db Resources
March 17, 2015 - Maui, HI
Recently I've been getting a number of questions related to customers having issues with running the Westwind.Globalization Database Resource provider library under ASP.NET MVC. While the original versions of this library were definitely WebForms centric since it originated in the WebForms era, the library has had full support for ASP.NET MVC for a while. In this post I'll review how localization works in ASP.NET MVC and then demonstrate how Westwind.Globalization handles the same scenarios with database resources.
Using FontAwesome Fonts for HTML Radio Buttons and Checkboxes
February 26, 2015 - Maui, HI
Spruce up your boring checkboxes and radio buttons with custom FontAwesome symbols using a little bit of CSS. If you're tired of boring checkboxes and radio buttons, or you simply want a more consistent look of these controls across browsers and controls check out FontAwesome to provide you with customizable checks and boxes to use for selection boxes. In this post I'll show how to use pure CSS to set up FontAwesome checkboxes and radios and talk about a few gotchas I ran into along the way.
Updating Assembly Redirects with NuGet
November 29, 2014 - Hood River, OR
There's little known NuGet command that allows you to re-create assembly redirects for all NuGet packages in your project or an entire solution.
A .NET QueryString and Form Data Parser
September 08, 2014 - Hood River, OR
.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.
West Wind WebSurge - an easy way to Load Test Web Applications
July 15, 2014 - Hood River, OR
Recently I had a need for a load testing tool and after quite a bit of frustration to find a decent reasonably priced load testing tool, ended up giving up searching and building one instead. In this post I introduce West Wind WebSurge, an easy to use Web load testing tool that makes it easy to stress test Web applications.
Creating ASP.NET MVC Negotiated Content Results
May 20, 2014 - Hood River, OR
ASP.NET MVC doesn't directly support content negotiation, but with a little bit of work it's very straight forward to implement a NegotiatedContent ActionResult that can switch its response type based on the Accept header.
Westwind Application Configuration Updates
April 29, 2014 - Maui, HI
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.
Forms Auth loginUrl not working after Windows Update?
February 15, 2014 - Maui, HI
Ran into a problem with Windows Update last week that seems to have broken forms authentication and the loginUrl attribute when set. Looks like new default settings are changing default behavior, and an extra configuration key is required to get the old default behavior back.
Checking out the Helios IIS Owin Web Server Host
November 23, 2013 - Maui, HI
During last week's MVP summit Microsoft showed a new light weight, Owin host called Helios, that can run directly on the IIS core without using the ASP.NET Runtime. It's light weight and fast, and offers a glimpse into where Microsoft is heading for building a more nimble and componentized runtime that is bound to be more flexible and agile. In this post I describe how to set up Helios to play around with and some of the implications it brings.
Visual Studio 2013 'Could not evaluate Expression' Debugger Abnormality
November 21, 2013 - Redmond, WA
Ran into an oddball debugger issue last week with an older project in Visual Studio 2013 where all breakpoints show 'Could not evaluate expression' instead of displaying values. This post shows the problem and a couple of ways around it.
Using HTML 5 SessionState to save rendered Page Content
July 01, 2013 - Hood River, Oregon
SessionStorage and LocalStorage provide easy client side storage for Web applications. In this post I describe a specific scenario for caching list display data and state for a server rendered HTML application using sessionState. See how you can make a server rendered HTML application more user friendly and faster caching content on the client and redisplaying it when the user returns to a page he navigated from.
Setting up and using Bing Translate API Service for Machine Translation
June 06, 2013 - Hood River, Oregon
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.
Publish Individual Files to your Server in Visual Studio 2012.2
May 10, 2013 - Maui, Hawaii
Visual Studio 2012 Update 2 introduces a little known new Web Publish feature that allows publishing individual files to the server. While not a high frequency usage case, it's handy for content files or when you just published a large project and realized you forgot to include a file in the project to publish.
Sql Connection Strings in .Config Files vs. Source Control
February 27, 2013 - Maui, Hawaii
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 - Maui, Hawaii
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.
Set-Cookie Headers getting stripped in ASP.NET HttpHandlers
November 29, 2012 - Maui, Hawaii
Ran into a nasty problem with Cookies not getting sent in HttpHandler code when using Response.AppendHandler() with the Set-Cookie key. It turns out it's a very narrow edge case, but one that can bite in unexpected system level applications.
DevConnections Session Slides, Samples and Links
November 13, 2012 - Maui, Hawaii
Finally getting around to posting links to my DevConnections session in Vegas a couple of weeks ago. It was a fun time after a long absence from speaking...
.NET HTML Sanitation for rich HTML Input
July 19, 2012 - Maui, Hawaii
If you need to sanitize raw HTML for display in Web applications, the job at hand is scary for .NET backends. Unfortunately it seems there aren't a lot of tools available to help in this formidable tasks and the tools that are tend to be inflexible to the point of often being unusable. In this post I show a base implementation of an HTML Sanitizer that can be customized for your own needs.
Rendering ASP.NET MVC Views to String
May 30, 2012 - Hood River, Oregon
Creating templated text output that's not tied to the HTTP output stream is a frequent requirement in my applications. Rendering confirmation emails, password resets, validations and notifications all generate text through templates that require string or stream output that doesn't get sent to HTTP. Here are some helpers that make it easy to create string output from MVC Views...
DropDownList and SelectListItem Array Item Updates in MVC
May 16, 2012 - Maui, Hawaii
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.
Getting a 'base' Domain from a Domain
April 24, 2012 - Maui, Hawaii
I was surprised to see that there wasn't some way in .Net to retrieve the base domain name from a sub-domain. For example, I want www.west-wind.com, and store.west-wind.com to return me just the base url. Easy enough but there are a couple small issues to check for especially when dealing with string based domain names.
Using an alternate JSON Serializer in ASP.NET Web API
March 09, 2012 - Maui, Hawaii
The default serializer in ASP.NET Web API (at least in Beta) is the DataContractJsonSerializer with all of its warts and inability to not serializer non-typed objects. In this post I'll talk about the issues and how to plug-in alternate JSON parsers to handle more complete JSON serialization in Web API.
Removing the XML Formatter from ASP.NET Web API Applications
March 09, 2012 - Maui, Hawaii
When viewing ASP.NET Web API output in browsers the content is usually displayed as XML which is not my preferred choice. Even though JSON is Web APIs default format XML continues to be displayed. Here's some discussion on why this happens and how you can work around it.
Using the HTML5 <input type="file" multiple="multiple"> Tag in ASP.NET
March 06, 2012 - Maui, Hawaii
HTML5 allows for multiple files to be uploaded from a single file input control. Here's how you can use it and capture files in ASP.NET.
Using the West Wind Web Toolkit to set up AJAX and REST Services
November 03, 2011 - Maui, Hawaii
Figuring out the IIS Version for a given OS in .NET Code
September 18, 2011 - Hood River, Oregon
Need to find the IIS version available for a given OS via code? Here's a small routine that handles this.
Building a jQuery Plug-in to make an HTML Table scrollable
May 28, 2011 - Hood River, Oregon
Table displays in limited space require some rendering alternatives. While paging is a common way to address fixed size displays, it's not an end-all solution. Sometimes it's necessary to display larger amounts of data in a small fixed space on an HTML page. Scrollable list are fairly easy to do with most HTML structures, but HTML tables are notoriously difficult to manage when it comes to scrolling. In this post I describe a jQuery plug-in that attempts to make any table scrollable by decomposing and reassembling the table into two distinct areas.
Displaying JSON in your Browser
April 01, 2011 - Maui, Hawaii
Ever need to display JSON in your browser and finding out that it's a pain? Here are some tips on how to display JSON data without pesky download dialogs or display errors in your favorite browser.
A jQuery Plug-in to monitor Html Element CSS Changes
February 22, 2011 - Maui, Hawaii
Allowing Access to HttpContext in WCF REST Services
January 10, 2011 - Maui, Hawaii
WCF REST Services do not make it easy to access all the features of the HTTP protocol, so in some situations it's just much easier to use ASP.NET compatibility to get direct access to the HttpContext object for access of all the HTTP headers and features.
Hosting the Razor Engine for Templating in Non-Web Applications
December 27, 2010 - Maui, Hawaii
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.
Microsoft and jQuery
November 01, 2010 - Maui, Hawaii
Using jQuery to POST Form Data to an ASP.NET ASMX AJAX Web Service
September 07, 2010 - Maui, Hawaii
ASP.NET and WCF AJAX Web Services and PageMethods natively don't accept urlencoded POST requests and so standard mechanisms for sending form POST data don't work directly with these services. However, with a few adjustments and using jQuery's .serizalizeArray() function it's possible to POST form data to ASP.NET Services and easily consume the form data.
RequestValidation Changes in ASP.NET 4.0
August 19, 2010 - Maui, Hawaii
ASP.NET 4.0 changes the way request validation works by default, pushing request validation into the ASP.NET pipeline from the Web Forms engine. This might cause some unexpected behavior if you've used the validateRequest Page level attribute to allow unsafe content to be posted but it can also cause problems in other scenarios.
What’s New in ASP.NET 4.0 Part Two: WebForms and Visual Studio Enhancements
May 04, 2010 - Maui, Hawaii
This article describes some of the useful new features in ASP.NET WebForms 4.0 as well some useful feature enhancements in Visual Studio specific to Web Development.
What’s new in ASP.NET 4.0: Core Features
May 02, 2010 - Maui, Hawaii
Microsoft released the .NET Runtime 4.0 and with it comes a brand spanking new version of ASP.NET – version 4.0 – which provides an incremental set of improvements to an already powerful platform. .NET 4.0 is a full release of the .NET Framework, unlike version 3.5, which was merely a set of library updates on top of the .NET Framework version 2.0. Because of this full framework revision, there...
DevConnections jQuery Session Slides and Samples posted
April 19, 2010 - Maui, Hawaii
I've posted my slides and samples from the DevConnections VS 2010 Launch event last week in Vegas.
Rendering ASP.NET Script References into the Html Header
January 02, 2010 - Maui, Hawaii
ASP.NET natively supports script embedding only into the body of the HTML document which is limited in many ways if you need more control over how scripts load under program control. In this post I'll show one of my components that allows embedding scripts and script references in the header of the document as well as many useful script embedding features for ASP.NET.
Making Sense of ASP.NET Paths
December 21, 2009 - Maui, Hawaii
ASP.NET includes a plethora of functions and utilities to retrieve information about the current requests and paths in general. So much so that it's often hard to remember exactly which path property or method you are actually looking for. This update to an old and very popular post from this blog summarizes many of the paths and path related operations that are available in ASP.NET.
A free standing ASP.NET Pager Web Control
December 14, 2009 - Maui, Hawaii
Although there's decent Pager support in ASP.NET controls the way paging works is inconsistent and not very generic. After a recent experience of creating a small pager component for MVC I decided having a generic non-data or control dependent Pager WebControl would be useful. In this post I cover a custom Pager control implementation that addresses some of the shortcomings with the stock paging functionality for me.
DevConnections Slides and Samples Posted
November 18, 2009 - Maui, Hawaii
I've posted my slides and samples from my 3 DevConnections sessions for you to download and check out.
Capturing and Transforming ASP.NET Output with Response.Filter
November 13, 2009 - Las Vegas, Nevada
Capturing ASP.NET response output can be done in a variety of ways. In this post I'll discuss how you can use a Response.Filter to capture output and transform it using a simple class that provides event hooks to make it easy to capture output.
ClientIDMode in ASP.NET 4.0
November 07, 2009 - Houston, Texas
The new ClientIDMode in ASP.NET 4.0 is one of my most anticipated features to reduce the naming clutter that ASP.NET naming container naming has traditionally introduced into page. In this post I describe the ClientIDMode behavior and the various ways of how you can control ClientID generation with ASP.NET 4.0
Ambiguous References in DefaultWsdlHelpGenerator.aspx
November 02, 2009 - Houston, Texas
Ran into an odd problem today where the default ASMX Web Service help page was blowing up with DataBinding errors due to ambiguous class names. Turns out that a custom control with the same name as a System component and a static method call resulted in ambigous reference errors.
Debugger Visualizers not working in ASP.NET Medium Trust
September 24, 2009 - Hood River, Oregon
Debugger visualizers are quite useful for looking at common content while in the middle of debugging your application. However I've run into a number of problems with the debugger visualizer not popping up in ASP.NET applications due to the security environment. Turns out you need full trust in order to use debugger visualizers in ASP.NET applications.
Integrating OpenID in an ASP.NET MVC Application using DotNetOpenAuth
September 17, 2009 - Hood River, Oregon
OpenId is getting more popular and with it requests to integrate it into Web sites as a user authentication mechanism. In this post I'll discuss the OpenId integration on CodePaste.net in an ASP.NET MVC application disuccing both high level OpenId concepts, the process and the code implementation.
Making jQuery calls to WCF/ASMX with a ServiceProxy Client
September 15, 2009 - Hood River, Oregon
This post revisits the WCF/ASMX ServiceProxy that can be used to make native jQuery calls to ASMX and WCF AJAX services. The component is self contained and provides JSON conversions including dates, as well as a simple class interface for simple one line service calls and consistent error trapping. This is an update that handles native JSON parsers. Includes examples and a detailed walk through on how it works.
WebResource access in ASP.NET MVC
July 30, 2009 - Saalfelden, Austria
WebResources are useful when building more complex components. In MVC ASPX Views you can still access the ClientScript object to retrieve ResourceUrls, but outside of the ASPX view there's no easy access to the ResourceUrl. This post describes how grab resource urls in a couple of different ways.
July 21, 2009 - Hood River, Oregon
As a learning experience for taking ASP.NET MVC for a spin I recently created a new site that has now gone live: Codepaste.NET which provides a public location to post code snippet and link them from social network sites that have limited input lengths and make code discussions otherwise difficult. The site's a work in process, but I hope it's useful to some of you for sharing and discussing small blocks of code online.
How do ASP.NET Application_ Events Work
June 18, 2009 - Hood River, Oregon
Most of us have used ASP.NET global.asax Application_ EventName handlers, but do you know how it is that these events are actually fired automatically by ASP.NET even when you add additional events by name? In this post my curiosity got away from me and I took a look under the covers to see what ASP.NET is doing to hook up these method to HttpModule events.
Don’t use Response.End() with OutputCache
May 21, 2009 - Maui, Hawaii
Got bitten by a silly problem that nevertheless has happened to me on several occasions: I'm trying to use OutputCaching in an HttpModule and found that the output simply NEVER cached. After some lengthy debugging I realized I missed an obvious problem that stared me straight in the face: A Response.End() after output generation that causes the pipeline to bypass caching.
Adding Default Assemblies, Namespaces and Control Prefixes in Web.Config
May 04, 2009 - Maui, Hawaii
One often overlooked feature of the ASP.NET runtime is the ability to specify default namespaces and control prefixes in web.config which can make it much easier to reference components in your pages. As more and more developers move away from using the designer and live exclusively in markup getting your custom controls to show without @Register tags is especially useful. Here's how.
IIS 7 Error Pages taking over 500 Errors
April 29, 2009 - Maui, Hawaii
I've been running into a problem with IIS returning error pages when my application is actually returning 500 errors along with custom content. IOW, IIS is taking over error display completely even if I send my own content for errors. This has some profound effects on error handling and on some custom handler implementations that relying on returning error information to the client. Thankfully there's a new ASP.NET 3.5 property that helps with this problem, although it's a rather obscure fix for this issue.
Creating Visual Studio Templates from your Web Projects
April 27, 2009 - Maui, Hawaii
Visual Studio has the nice capability to create project templates from existing projects and with a little bit of work it's real easy to create a project environment that's ready to roll without having to dig for related components first. This applies to Web projects more than anything for me as I have a fair bit of generic utility code that is project specific and needs to be added to just about all projects. Templates make this real quick and easy. Here's how.
Web Application Project generated CodeBehind .designer file not being updated
April 07, 2009 - Maui, Hawaii
I've been running into problems with WAP page CodeBehind files (.designer.cs) files not being updated from time to time. Here's how this can happen and a few ways to fix the problem and get on with life.
April 02, 2009 - Maui, Hawaii
Updated Westwind.Globalization Data Driven Resource Provider for ASP.NET
April 01, 2009 - Maui, Hawaii
Getting an ASP.NET Application Relative Path from a Logical Path
March 28, 2009 - Maui, Hawaii
On a few occasions I've found it necesary to retrieve an application relative path. ASP.NET provides tons of path related functions but there is nothing generic that provides purely application relative paths. Here are ae couple of functions that provide that for local pages and for any page based on a logical path.
Opening a WAP IIS Project when IIS Virtual doesn’t exist
March 24, 2009 - Maui, Hawaii
Web Application have a nice feature to create a virtual if it doesn't exist and you're using IIS for your project. Unfortunately if you don't want to create a virtual the operation unceremoniously doesn't load your WAP project. Here's how to get around this and a suggestion on how this feature could be improved.
Showing Syntax Colored Source Code in ASP.NET Content
February 25, 2009 - Maui, Hawaii
Code Syntax Highlighting in HTML pages and the ability to display source code for specific pages in samples is something I do a lot of. Here is what I use for code highlighting in text snippets and for displaying source code in samples easily.
Using Enums in List Controls
February 20, 2009 - Maui, Hawaii
Using enums for display value in applications can be nice and easy with a little bit of help. While enums generally shouldn't be treated as data, in some situations it might just be more convenient to use enum definitions rather than database look up tables for data that is defined in the object/domain model. Here are a few ways you can easily use these enum values.
Error Creating Control Errors in the ASP.NET Designer
February 16, 2009 - Maui, Hawaii
I've been suffering from ASP.NET designer errors that force a Visual Studio restart. I don't use the designer very much - just for a few special cases like using Extender controls - but when I do the designer is incredibly frustrating and here is another example just why.
Removing the .SVC Extension from WCF REST URLs
December 15, 2008 - Maui, Hawaii
One of the most frequent questions that come up when talking about WCF REST urls is how to remove the .SVC extension from the endpoint Url for a REST service. While it's not automatic, there are a couple of fairly simple solutions to this problem: Using the IIS 7 Rewrite Module or a small custom module.
jQuery and ASP.NET Article Part 2 Posted
December 03, 2008 - Maui, Hawaii
I've posted Part 2 of my jQuery with ASP.NET article series. Part 2 deals almost entirely with making AJAX callbacks to ASP.NET using several different mechanisms to retrieve data from the server for client side consumption. Covered are external content retrieval, same page callbacks, WCF/ASMX and a pluggable custom callback implementation that can be used with any application. Also covered is client side templating for managing HTML in one place.
WCF REST Services and AJAX Callbacks
November 26, 2008 - Maui, Hawaii
I've been getting a lot of questions in response to my WCF REST session in regards of whether I'd recommend switching to WCF from ASMX services for AJAX functionality recently. WCF provides a host of new REST features, but when it comes to AJAX functionality and especially ASP.NET AJAX compatible functionality there's really nothing compelling there to require changes. In this post I look at what WCF provides for AJAX and some of the things you might watch out for.
ASP.NET Connection Session Slides and Samples Posted
November 17, 2008 - Maui, Hawaii
I've published my session slides and samples from the Fall 2008 ASP.NET Connections conference. The sessions include: jQuery and ASP.NET, WCF REST and JSON with ASP.NET and Dealing with Long Running Requests in ASP.NET.
From ASP Stock Projects to Web Application Projects in VS 2008
November 06, 2008 - Maui, Hawaii
Had to do a conversion of a stock ASP.NET project to Web Application projects after not having done so in quite some time and it looks that this process still is not any easier than it was when WAP was a separately installed project type. Here are steps to move a project from stock to WAP with a few hopefully helpful hints.
HTML Mangling with Literal Controls in the <head> tag
October 20, 2008 - Maui, Hawaii
Ran into an odd problem with Literal controls in the head tag of the document causing HTML to get corrupted today. It appears that literal controls - and only literal controls - are causing some odd designer manglage that can result in broken HTML.
Introduction to jQuery Article posted
September 28, 2008 - Maui, Hawaii
Browser Rendering Differences and Browser Resets
September 24, 2008 - Maui, Hawaii
As ASP.NET develoers it can be really easy to not pay attention to good CSS style layout practices. But CSS is vitally important especially when dealing with different browsers and consistent formatting. Using browser resets in particular is a big help in taking some of the pain out of cross browser rendering differences.
ASP.NET Designer Control Problem in VS 2008 SP1
September 18, 2008 - Maui, Hawaii
I've been running into problems with VS 2008 SP1 where controls appear to be failing frequently with property assignment errors that seem completely unwarranted. Controls work fine on a page, and next thing I know they fail for no apparent reason.
Client Script Resources in ASP.NET Controls revisited
September 09, 2008 - Maui, Hawaii
Embedding script resources as part of ASP.NET Control development is tricky business and requires a bunch of options to ensure that script code loads correctly and maybe more importantly allows the page developer to decide whether the resources should be used at all. Here are a few thoughts and some work in progress on how I deal with script resources in my controls.
Retrieving Web Resources and Content Types in Code
September 08, 2008 - Maui, Hawaii
One of my components requires to serve specific Web Resources directly and optionally compress them optionally. While serving resources is straight forward, also grabbing the content type to know what type of resource you're dealing with is a little more work. Here's how.
jQuery Form Serialization without ASP.NET ViewState
September 04, 2008 - Maui, Hawaii
When building AJAX applications that send client form content to the server, ViewState and EventValidation fields can get in the way. Using jQuery you can make short work skipping over these fields and send only the raw POST data to the server.
Watch out for Date Kind in JSON Deserialization
September 03, 2008 - Maui, Hawaii
If you're working with dates in JSON serialization make sure you carefully normally dates returned from JSON deserialization. Reason is that especially the Microsoft Serializers return dates as Utc dates which can produce some unexpected and often missed results.
FireFox 3 and Static File Caching Problems
August 31, 2008 - Maui, Hawaii
FireFox 3.0 apparently is much more aggressive in caching content than previous versions of FireFox. While this is good for performance in many situations I've noticed that this is seriously becoming a problem in some of my applications where support files like scripts and CSS files get updated in applications and FireFox doesn't recognize those changes. The problem appears to be that FireFox is...
Unable to debug Web Site with Top Level Location
August 28, 2008 - Maui, Hawaii
Ran into another fun little problem a few days ago. Working on my root Web site which is rather large and contains a huge number of sub-webs. The root site is very light in terms of ASP.NET functionality used - primarily stuff like cookie tracking and logging tasks, serving banners etc and a few utility applications. Most of the heavy lifting on the site and 'real' applications are managed in...
Lost (and found) Visual Studio Templates in Web Project
August 27, 2008 - Maui, Hawaii
So I just lost all of my project templates in Web projects. I've been working on a small utility page on my site that generates help documentation on the fly. I've been working happily along on this site when all of a sudden when I needed to add a config file to control debugging and authentication on this page/app. could not find a part of the path 'C:\programs\vs2008\ Common...
ASP.NET gets no Respect
August 14, 2008 - Hood River, OR
As an ASP.NET developer I'm pretty much sold on ASP.NET as a platform. I've used ASP.NET since the beginning of the early .NET betas and while I originally had a tough time getting started with it, I eventually came to really enjoy the framework. But once I understood the platform and the flexibility it offers, it's now really hard to think of any other Web development platform that I'd rather be...
Server Errors when updating live Web Applications online
August 11, 2008 - Hood River, Oregon
In the last few weeks I've been noticing some problems with site updates I've made to my live server. I have an application running locally and it's running fine without problems. The app is running as a Web Application Project (WAP) and so when I update the application most of the time I only update the BIN folder and possibly one or two of the ASPX markup pages. So I upload all files out of the...
JSON Serializers in .NET - not there yet
August 04, 2008 - Hood River, Oregon
.NET Framework 3.5 provides a couple of choices for JSON Serialization and Deserialization. Find out how you can use them and also some of the problems that both of these tools impose.
jQuery with ASP.NET Presentation at Portland .NET User Group on Tuesday
August 01, 2008 - Hood River, Oregon
West Wind Ajax Toolkit updated
July 15, 2008 - Garda See, Italy
I've finally had some time to update the West Wind Ajax Toolkit to version 1.90. A number of these changes I've written about and have updated previously, but this update finalizes a number of these updates into a full release. There are a number of enhancements to the existing functionality as well as a few new helper components that I'm finding very useful these days. As always you can grab the...
Static Singletons for ASP.NET Controls
July 11, 2008 - Garda See, Italy
When building generic ASP.NET Server controls that also provide a sort of API service to other custom controls or page level code, it's often necessary to ensure that only a single instance of a control exists, and that only that single instance of this control or component can be accessed in the context of an ASP.NET request. Using HttpContext and it's Item collection makes it easy to create reusable, cacheable instances and ensure you're only running a Singleton instance of it.
Updated jQuery and WCF 3.5 JSON Samples posted
June 25, 2008 - Murten, Switzerland
I've updated my slides and samples for last spring's Devconnection's sessions to reflect some of the recent updates in jQuery and jQuery.ui, which now have been updated to release versions. In addition there have been a few bug fixes and better configuration documentation for the samples.
Ending a Response without Response.End() Exceptions?
May 26, 2008 - Frankfurt, Germany
There's not really a clean way to end the current Response output and then keep on processing an ASP.NET request. Here's a scenario and a few observations on Response closing behaviors.
Non ASPX Extensions and Authentication in the IIS 7 Integrated Pipeline
May 23, 2008 - Frankfurt, Germany
Ran into an issue where IIS 7's integrated pipeline exhibits different behavior authenticating non ASPX extensions. Looks like IIS 7 only authenticates mainline files resulting in Context.User==null or Context.User.Identity.IsAuthenticated==false. For example hitting CustomHit.axd doesn't provide user credentials where an ASPX url does.
jQuery puts the fun back into Client Scripting
May 10, 2008 - Berlin, Germany
April 28, 2008 - Hood River, Oregon
Sortable lists are a common thing to work on and jQuery.ui's Sortable plug in makes it super easy to create very nice looking sortable lists that work consistently even in complex layouts.
jQuery AJAX calls to a WCF REST Service
April 21, 2008 - Orlando, Florida
Here's an overview of how to call WCF REST services with jQuery. The basic process is very easy, but if you want to handle the formats that Microsoft sends down reliably, you have to make some format choices and deal with JSON encoding and decoding that is not native to jQuery.
WCF REST Configuration for ASP.NET AJAX and plain REST Services
April 10, 2008 - Maui, Hawaii
.NET 3.5 includes WCF REST service functionality that allows for cleaner HTTP access to services. For AJAX applications this means that WCF can now be used both for MS AJAX clients as well as non-MS AJAX clients like jQuery or Prototype. This post focuses on setting up and configuring WCF for REST operation with a focus on AJAX scenarios looking at some of the different configuration options available.
WCF REST Services and Could no load file or assembly... Error?
April 08, 2008 - Maui, Hawaii
I'm working with a few different WCF REST services for some demo code and I've been getting an inconsistent error, every few hours. I've been getting the old "Could not load file or assembly... or one of its dependencies. The system cannot find the file specified" errors when accessing the WCF .SVC file in an ASP.NET hosted WCF service: The odd thing about the error is that it only occurs with...
Client Side Templating with jQuery
April 03, 2008 - Maui, Hawaii
When building AJAX applications there's often the requirement to choose between client and server side rendering. Server side ASP.NET controls provide rich templating, but updating those controls on the client can be difficult. Or is it? Here's one approach using jQuery and HTML templates in markup script to dynamically create complex layout on the client without writing reams of script code.
Rendering individual controls for AJAX Callbacks
April 01, 2008 - Maui, Hawaii
It's quite handy to render HTML as part of AJAX callbacks and spit it back to the client. It's quite easy in fact to take advantage of ASP.NET Web Form rendering to render individual controls or compound user controls and pass them back to provide partial rendering even if you're using tools like jQuery, Prototype etc. rather than using ASP.NET AJAX.
Grayed out ASP.NET Toolbox Controls? Check your Mouse!
March 15, 2008 - Maui, Hawaii
Have you run into a problem with the ASP.NET where you can't access toolbox items for add-on controls? You're not the only one. Apparently there's a bug that causes some hardware configurations involving Microsoft Laser mice to cause problems with the idle state that the designer uses to refresh controls and certain designer aspects.
Debugging Http or Web Services Calls from ASP.NET with Fiddler
March 14, 2008 - Maui, Hawaii
If you've tried to trace Http requests to Web Services or WebRequest calls in an ASP.NET application you've probably found although ASP.NET requests show up in tools like Fiddler or Charles, but the Web Service or WebRequest/WebClient calls do not. You can make this work however by modifying the proxy settings in web.config explicitly.
Firefox 3.0 XmlHttpRequest Default Content-Type change
March 12, 2008 - Maui, Hawaii
I ran into a small problem with some of my AJAX code that's checking content-type on inbound requests from the client - it looks like FireFox 3.0 is now including the charset on the content type from the client on POST operations which if not explicitly checked for can break existing code expecting only to see a content type. Small issue, but easy to miss especially in framework code like mine that frankly should have been prepared for this...
Updated Data Driven ASP.NET Resource Provider Posted
March 11, 2008 - Maui, Hawaii
I've update the source and samples for the wwDbResourceProvider component which provides an ASP.NET Resource Provider that is driven from resources stored in a SQL Server database. The tool also includes a real time ASP.NET resource editing front end and the abillity to import and export resources. This update fixes a few small bugs and enhances the ASP.NET resource editing front end with a few UI and AJAX tweaks.
Watch out for Collection property Setters in ASP.NET Controls
March 10, 2008 - Maui, Hawaii
If you've ever run into the ASP.NET Control Design time error "Cannot create Control" you may have run into a small but easy to miss details about collection properties in ASP.NET controls: The controls can't have a setter if they are serialized from the designer or an error will occur in the designer even while code runs just fine at runtime.
February 21, 2008 - Maui, Hawaii
This post discusses some updates to the wwScriptVariables class I talked about last week. This class provides an easy way to access server variables in client script, automatically expose ClientIDs as simply ID values and provides a mechanism for client code to send updated values back to the server to consume easily.
February 12, 2008 - Maui, Hawaii
jQuery Intellisense in Visual Studio
February 11, 2008 - Maui, Hawaii
Getting jQuery to work with Intellisense in Visual Studio is now possible after Microsoft updated script parsing code in a recent hotfix. Although there are improvements in basic parsing and some Intellisense is supported, by making some very minor comment changes to jQuery.js can improve Intellisense support drastically.
Visual Studio Hotfix for Slow Web Forms Editing and Input Focus Issues
February 08, 2008 - Maui, Hawaii
Microsoft has just released a hotfix for a number of issues that have been plaguing me for some time in Visual Studio 2008. The issues involved have to do with the visual designer and the HTML code editor and a number of different input focus and slow input situations. You can get the hotfix from here:...
Linq to SQL DataContext Lifetime Management
February 05, 2008 - Maui, Hawaii
The DataContext is the central object that holds LINQ to SQL together. This post talks about a few different approaches you can use to hang on to your DataContext in the course of a request, to pass between layers or to manage on a per thread/request level.
Issue: Migrating Web Application Projects between VS 2005 and VS 2008
January 22, 2008 - Maui, Hawaii
If you move Web Application Projects between Visual Studio 2008 and Visual Studio 2005 and a machine that doesn't have Visual Studio 2005 installed you will find that the project doesn't load due to a build target difference.
Forms Authentication and path= in the <forms> Tag
January 20, 2008 - Maui, Hawaii
Ah the beauty of a self made blunder - I managed to bungle up a
tag's path in web.config which caused some very unpredictable behavior that essentiall failed all forms authentication requests.
SmtpClient in Medium Trust
January 18, 2008 - Maui, Hawaii
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 - Maui, Hawaii
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...
Doing away with an Assembly Dependency
January 12, 2008 - Maui, Hawaii
I'm looking at some oldish code that sits inside of a web control library. This is my main web control library were I keep all of my custom controls that I typically use. It includes all the AJAX controls, a custom databinder, some generic status display controls, a number of stock control...
wwHoverPanel/West Wind Ajax Toolkit Updated
January 08, 2008 - Maui, Hawaii
I've finally had a bit of time over the holidays to roll in a few updates into my wwHoverPanel library. In the process I decided that wwHoverPanel is not really a fitting name for the library anymore since it does quite a bit more than that by now, with the hover panel operation only being a part...
Visual Studio and <location> parsing in web.config
January 02, 2008 - Maui, Hawaii
So here's a funky Visual Studio behavior: On my root Web site (which is mostly static) I have my web.config set up to handle the root site configuration in a separate <location> element in order not to force the settings of the root site down into the many, many virtual...
Weird DataGrid Paging Error with Last Page Selection
January 02, 2008 - Maui, Hawaii
This is one posts of an oddball problem I've run into where I feel like I 'shoulda known' but just didn't for - way too long <g>. I have a form in my Web Store with a DataGrid on it. Yeah the form is pretty old and dates back to 1.1 but I hadn't changed over because the page is inherited and...
DataContractJsonSerializer in .NET 3.5
December 29, 2007 - Maui, Hawaii
.NET 3.5 includes a new DataContractJsonSerializer that makes it real easy for serializing and deserializing .NET objects to and from JSON. This post shows code for simple serialization and deserialization as well as discussion of some of the features and limitations.
December 27, 2007 - Maui, Hawaii
.NET 3.5 includes a new DataContractJsonSerializer that makes it real easy for serializing and deserializing .NET objects to and from JSON. This post shows code for simple serialization and deserialization as well as discussion of some of the features and limitations.
JSON and Date Embedding
December 24, 2007 - Maui, Hawaii
I'm a bit mystified by various JSON implementations out there that don't seem to be dealing with dates correctly. I've been using Douglas Crockford's JSON implementation from JSON.org and originally I had to fix up the date processing so that it would work on both ends for serializing and...
Charset Encoding in ASP.NET Response
December 23, 2007 - Maui, Hawaii
Updated jQuery Calendar to jQuery DatePicker
December 21, 2007 - Maui, Hawaii
A couple of months ago I posted an ASP.NET wrapper around Marc Garbanski's Calendar control. Just so was my luck that a couple of weeks after I created the control Marc rev'd the jQuery control, renamed it and basically overhauled the control for it's inclusion as part of the jQuery UI suite....
Updated ASP.NET wwCaptcha Control on the WebLog
December 20, 2007 - Maui, Hawaii
Sat down yesterday to create a quick imageless Captcha control that is self contained in a single page using simple Math expressions instead of images to handle page validation to avoid the multiple hit and Cache hit transferring information between the page and an HTTP module.
LINQ To SQL and the Web.Config ConnectionString Value
December 07, 2007 - Maui, Hawaii
I just got had by an odd behavior in the LINQ to SQL model designer when working with a LINQ to SQL Model in a separate class library project. I use LINQ to SQL in a business layer which always lives in a separate assembly and so the model does not live in the same project as the Web (or other)...
What's Ailing ASP.NET Web Forms
November 27, 2007 - Maui, Hawaii
The recent announcement that ASP.NET will soon get an alternate engine in the ASP.NET Model View Controller framework (MVC - see last month’s editorial) has brought out some renewed discussion of the merits and shortcomings of Web Forms and the potential need for an alternate mechanism of building...
Getting Images to render properly in the ASP.NET Designer
November 21, 2007 - Maui, Hawaii
I'm embarrassed to say that I didn't quite know how to get controls to render image urls properly in the designer. The situation is as follows: You create a custom server control and you have an image property and you allow the use of the ~/images/someimage.gif syntax to specify the image path. I...
Debugging a FoxPro COM Object under ASP.NET
October 15, 2007 - Hood River, Oregon
Some time ago I posted some code that you could use with ASP.NET to debug COM objects somewhat interactively in Visual FoxPro. The old approach used an old trick to instantiate VisualFoxPro.Application from within IIS and then actually launching code to instantiate an object created inside of VFP...
Implementing a jQuery-Calendar ASP.NET Control
October 08, 2007 - Hood River, Oregon
I've posted a wrapper ASP.NET around the jQuery-calendar control from Marc Garbanski. This small client side calendar control is compact, looks nice and is very easy to use and I've added an ASP.NET wrapper around it so it can more easily be more easily used with ASP.NET applications by dragging and dropping onto a form and supporting postbacks of the SelectedDate.
A simple Business Object wrapper for LINQ to SQL
September 27, 2007 - Hood River, Oregon
I've been talking about how I'm using a small business object wrapper around LINQ to SQL to provide better abstraction of the LINQ to SQL functionality and I suppose the time's come to be bit more specific. This is going to be a long post with a fair bit of code and a brief discussion of the whys and hows...
ASP.NET and Styles & CSS Embedding
September 24, 2007 - Hood River, Oregon
One thing that really bugs me about ASP.NET is the way it deals with header management especially when working with Themes. One of the big problems I see is that ASP.NET embeds the Themes style sheet at the bottom of the header list. If you happen to be using Master Pages which can have a header...
Forms Authentication and Persistant Login Problems
September 23, 2007 - Hood River, Oregon
I'm mucking around with an authentication form that requires some extra authentication data for the user, so rather than using the stock Login control and it's authenticate method I'm using a custom ticket and manually redirecting the data. I'm not sure how this option to stick custom user data...
jQuery and jQuery UI and maintaining a custom Client Library
September 22, 2007 - Hood River, Oregon
I've been spending some time over the last couple of days working with jQuery and a few helper components. jQuery a week ago or so released version 1.2 and a few days later a new jQuery UI library which looks to be pretty cool for a number of reasons. If you haven't looked at jQuery before I...
LINQ to SQL Serialization bites me again
September 21, 2007 - Hood River, Oregon
I'm mucking around with a bit of code today that's using AJAX and returning some data from my business layer that's using LINQ to SQL Entities. I mentioned some time that one issue that I ran into and continue to bump my head against is that LINQ to SQL has big issues serializing its entities. The...
ResolveUrl() without Page
September 18, 2007 - Hood River, Oregon
If you're writing generic non-Page code in handlers, modules or other system components for ASP.NET you might find that at times you need to use ResolveUrl(), only to find that this functionality is not available outside of the Control class. Here's a generic routine, and another variation that can return a fully qualified absolute path using the familiar ~ syntax outside of the Page framework.
Missing PageMethods on an MS AJAX Page?
September 14, 2007 - Hood River, Oregon
You ever have one of those days when just nothing wants to go right? A couple of days ago I was working on my session code for ASP.NET Connections. One of my sessions is on Dealing with Long Running Requests and one of the examples uses AJAX to offload the processing to messaging engine and...
wwHoverPanel AJAX Control Updated
September 12, 2007 - Hood River, Oregon
I've updated the wwHoverPanel library yesterday with a number of small bug fixes and a handful of new features and enhancements. Most of these are cosmetic. wwHoverPanel is a small AJAX library that I use in my internal tools and products and it provides a few core features: Simple JSON remote...
FormVarsToObject - a quick way to collect form input values
September 06, 2007 - Hood River, Oregon
Here are a couple of small routines that let you quickly collect ASP.NET form variables into an object or a data row with a single line of code. This routine comes in handy in many situations where full databinding may not be involved or more commonly in AJAX scenarios where no form databinding can be applied on Page level callbacks.
Dynamic Expressions in Linq to Sql
August 28, 2007 - Hood River, Oregon
Using LINQ there are two issues that I've been struggling with and both have to do with dynamic query results: Hitting the wall with SQL that can't be expressed via LINQ and using dynamic expressions inside of LINQ queries from within framework level code. As it turns out there are ways that this can be addressed with lower level LINQ methods that provide the abillty to be a bit more flexible in controlling what SQL gets executed and creating dynamic expressions for results.
Creating a scrollable and grouped Repeater Layout
August 23, 2007 - Hood River, Oregon
A couple of people asked me today about a layout I put together for an application. The layout is bascially a scrollable and grouped repeater that looks a little like a ListView control in WinForms. This sort of layout can be great for longer lists when paging is not really the right choice - a common scenario in AJAX applications actually. Here's a quick walk through on how this layout is put together.
Strong Name Validation failed when Debugging ASP.NET on IIS7
August 21, 2007 - Hood River, Oregon
Ugh, since I installed a new machine I ran into this error message above earlier. That's a pretty omnious sounding error message which seems to hint at a mis-configuration during installation. The error occurs as soon as you try to debug a Web application against IIS 7... As it turns out the...
GridView and Paging Alignment
August 18, 2007 - Hood River, Oregon
The GridView's Pager row is a pain to get properly right aligned in a cross browser fashion. While the alignment settings that the control provides work in IE, they fail to properly right align in Firefox and a bit of work is required to get it to work right.
LINQ to SQL and Disconnected Entities Follow-up
August 15, 2007 - Hood River, Oregon
Several people have been flogging me for my LINQ and disconnected Entity post, so I thought I should follow up on the issues I've been having. First let me restate Entity issue I raised a couple of days ago, but let me present it in a simpler context with the Northwind database, so you can try...
IIS/ASP.NET Settings and Virtual Directory Inheritance
August 11, 2007 - Hood River, Oregon
Root directory web.config settings can easily interfere with child virtual application settings causing all sorts of problems. Here's why this is a problem and how to get around it.
Shutting up Invalid ViewState from SPAM bots
July 31, 2007 - Hood River, Oregon
Somehow, sometime ago a spambot got into my Web Store and picked up a couple of pages and decided to just POST random (and randy <s>) SPAM to this URL to the tune of a few hundred POSTs a day by now. The funny thing about this is that the URL is just a product page that accepts only a...
Web Application Project Conversion on Orcas
July 30, 2007 - Hood River, Oregon
I'm going once again through a conversion from Stock Projects to a WAP project conversion this time for my Web Store. I've done the conversion once before but returned back to stock projects because of a Visual Web Developer requirement. Recently though development on the store has been a lot...
Resource Unloading in a custom ASP.NET Localization Resource Provider
July 24, 2007 - Hood River, Oregon
In ASP.NET 2.0 ResourceProviders allow extension of the native resource mechanism with your own resource backing store by implementing a custom ResourceProvider. It's fairly easy to create a new provider but figuring out how to unload resources with a dynamic resource store like a database is not quite straightforward. Here's how...
Loading an ASP.NET Page Class dynamically in an HttpHandler
July 23, 2007 - Hood River, Oregon
I ran into an interesting post on the ASP.NET forums today where someone is trying to dynamically invoke a page class inside of an HttpHandler. Basically the idea is that you have a class for the page that exist and you're dynamically invoking the class rather than letting the ASP.NET BuildManager...
Stupid Pet Trick # 522
July 20, 2007 - Hood River, Oregon
Thought I'd share a really silly developer story here. A while back I built a scheduler application for ASP.NET which checks a POP3 mail box and looks for certain content. The app just pulls all messages and deletes them as it finds them (optionally) and forwards them to another email address with...
Creating a data driven ASP.NET Resource Provider and Editor Article posted
July 18, 2007 - Hood River, Oregon
I finally managed to write up my data driven resource provider as an article. It ended up being quite a task getting it all to fit into an article and I actually ended up with TWO freaking articles - one an introduction and one for the resource provider and editor implementation. <s> Yeah,...
Generate Local Resources forces Culture="Auto" into Page
July 14, 2007 - Hood River, Oregon
Here's a real annoyance in Visual Studio's Generate Local Resources feature: When you generate local resources within the IDE ASP.NET will automatically add Culture="Auto" and UICulture="Auto" to the page header. While this may seem Ok at first this is really, really lame if you are managing...
July 14, 2007 - Hood River, Oregon
GoDaddy and SocketPermissions
July 11, 2007 - Hood River, Oregon
So I just got off the phone with support at GoDaddy for one of my customers and was told "Sorry we can't do that", when asked to provide socket permissions to go out and hit a POP3 server. GoDaddy has the web.config locked down and so you can't override the originUrl="site" so my customer is dead...
IIS Application Pool Crashes due to Temp File Permissions
July 10, 2007 - Hood River, Oregon
My Web Server has been throwing a bunch of nasty errors recently and I've been trying to figure out what the heck is going on. The problem is that apparently App Pools have been crashing hard fairly frequently. In most cases this isn't a big deal as IIS will immediately spin up another app pool,...
JSONP for cross-site Callbacks
July 04, 2007 - Hood River, Oregon
wwHoverPanel ASP.NET Ajax Control Update
July 03, 2007 - Hood River, Oregon
I've just uploaded a new version of the wwHoverPanel control. wwHoverPanel is a small AJAX library that provides some useful and common functionality in an easy to use and lightweight package. The library consists of a couple of controls that provide quick client side...
HttpWebRequest and GZip Http Responses
June 29, 2007 - Hood River, Oregon
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...
Images as Style Attributes
June 29, 2007 - Hood River, Oregon
Here's a little tip that I started using more frequently recently that involves images. When embedding images into pages you're often inclined to use an IMG tag or an ASP.NET image control. In some situations though - especially if the same image repeats on the page - it can be much more efficient...
June 27, 2007 - Hood River, Oregon
I am cleaning up my localization provider code for my presentation tomorrow at PADNUG (uh, today I guess <g>) and while I'm at it checking for proper operation in medium trust. This is the sort of thing I should be doing right from the start - start with Medium trust and then fix...
Finding Child Item Controls in ASP.NET
June 26, 2007 - Hood River, Oregon
I was mucking around with some old control code today where I have a control that has an array of child items. While making some modifications I realized that I really wanted to make some of these controls available as child controls. But alas it turns that ASP.NET is not readily firing any 'add'...
Global Resources Localization Suggestion for ASP.NET
June 24, 2007 - Hood River, Oregon
ASP.NET provides the ability to use strongly typed resources for Global resources that are contained in App_GlobalResources. This is a nice feature, but it has a pretty major flaw as it's implemented right now. The way this works is that you have your Resx file in App_GlobalResources and...
Hiding ASP.NET Controls from the Toolbox
June 22, 2007 - Hood River, Oregon
I've often built custom ASP.NET controls that contain other custom child controls. For example, I have a DataBinder control that contains individual DataBindingItems which are based on Control. The problem is that by default these child controls show up on a control list. Here's what the...
June 22, 2007 - Hood River, Oregon
IIS 7 has improved and simplified support for GZip encoding enabled out of the box and for the most part it seems to be working well on my Vista install. I see my CSS and other text content properly GZip encoded. IIS 7 also allows you to encode dynamic content easily which is nice because that was...
Speaking at PADNUG on Wednesday: Data Driven Localization
June 21, 2007 - Hood River, Oregon
I'll be speaking at the Portland Area .NET User Group next Wednesday. The topic is: A Data Driven Approach to Localization with ASP.NET This session provides an introduction to localization with ASP.NET as well as demonstrating how to extend ASP.NET with a custom data driven ResourceProvider. The...
STA Threading Issues in ASP.NET
June 15, 2007 - Hood River, Oregon
Recently I built an HttpHandler to replace my ISAPI interface for Web Connection, which is an application interface that provides Web connectivity to Visual FoxPro. The ISAPI extension has been working fine for many years, however with the advent of IIS 7 I figured it's time to create a more...
Properties getting mixed up in VS 2005 ASP.NET Visual Designer
June 11, 2007 - Hood River, Oregon
Here's an interesting problem in the ASP.NET designer in VS 2005: I have a custom control that has two properties with similar names. Somehow Visual Studio's designer appears to be getting the properties mixed up when trying to display the properties in the property sheet. Here are the property...
GridView and CommandArguments
June 07, 2007 - Hood River, Oregon
I don't know about you, but I cringe every time I need to create a GridView based layout that needs to create a few custom link handlers off that grid. The typical scenario might be a list where you can toggle certain options or where you can fire an operation that otherwise updates the data that's...
IE Lockup with createElement and appendChild
June 04, 2007 - Hood River, Oregon
I've been working on some client side AJAX code in a photoalbum application and I ran into a horrible situation today with IE. This innocuous code which is part of my library code (which in this case pops up an opaque overlay ontop of the page generically to render another window with an image...
__doPostBack and the Back Button
May 22, 2007 - Hood River, Oregon
One of my Web Connection customers (but this also applies to ASP.NET) recently posted a question regarding a page that wasn't working correctly when using the Back button. The behavior would be something like this: Go to the page Click a link that causes a __doPostBack() to occur Click the...
Downloading a File with a Save As Dialog in ASP.NET
May 21, 2007 - Hood River, Oregon
This seems to be a common question that I hear frequently: How do I download a file from a Web site, but instead of displaying it in the browser see it as a file that can be saved (ie. see the Save As dialog)? Normally when you link a file that file will always display inside of the browser because...
Watch out with precompiled ASP.NET 2.0 Applications if you have Orcas installed
May 17, 2007 - Hood River, Oregon
Here's a stumper. Today I made a very minor change to my Web Store application. It's basically and administrative tweak to capture spam IP addresses and store them for later optional blocking. The change made didn't touch anything in the rest of the application. The Web Store is my last app that's...
May 16, 2007 - Hood River, Oregon
I took a little bit of time today to make a few minor changes to the blog here and added some enhancements to the comments section here. One of the additions is support for Gravatars which is a very simple REST based mechanism that lets you show an avatar image. Gravatar is implemented by quite a...
IE DOM's dragstart Event interferes with 'manual' Mouse Movements
May 15, 2007 - Hood River, Oregon
Forcing an ASP.NET Application to 'stay alive'
May 10, 2007 - Hood River, Oregon
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...
Blocking IIS IP Addresses with ASP.NET
April 28, 2007 - Maui, Hawaii
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 - Maui, Hawaii
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...
Dynamically hooking up HttpModules
April 06, 2007 - Maui, Hawaii
Ran into an interesting question on the ASP.NET newsgroup today regarding a problem I've run into a few times myself. The issue revolves around virtual directory folder inheritance and web.config settings getting inherited from a root Web site. Anyway - one issue that has come up a few times is...
A dynamic class loading HttpHandlerFactory
April 02, 2007 - Maui, Hawaii
Here are a couple of examples of how you can route custom script map extensions to your custom HttpHandlers.
Nested Item Templates for custom script extensions in Visual Studio
March 27, 2007 - Maui, Hawaii
I'm working on an application that's using custom HTTP handlers to handle inbound Web requests where each script request is pointing at an HTTP handler. In this case the handlers need to be individual files so I have a script map configured in IIS with a special extension and then mapped to my...
Using Project Template Export to create a generic WAP Template
March 26, 2007 - Maui, Hawaii
I have a customer coming out tomorrow for a week long gig and as I was preparing for tomorrow's session I needed to set up new project. Starting up a new project and getting all the pieces into place for a Web application involves a fair amount of setup for me usually as I typically startup with a...
System.Argument Exceptions in W3wp.exe and the VS Just-in Time Debugger
March 25, 2007 - Maui, Hawaii
I've been noticing that on my server quite frequently I get managed exceptions bubbling up to the Dr. Watson and/or the Visual Studio Just In Time Debugging dialog on the desktop. Now this being a server machine I'm not happy about this happening of course because it clutters the desktop the next...
The Type Initializer for System.Drawing.ToolboxBitmapAttribute threw an exception
March 11, 2007 - Maui, Hawaii
Here's a fun exception that popped up in my admin error mail box today:/wwStore/item.aspx?sku=wconnectThe type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception. on 3/11/2007 10:34:49 pm--- Stack Trace --- at System.Reflection.CustomAttribute._CreateCaObject(Void*...
MetaWebLog API and Blog Writers
March 10, 2007 - Maui, Hawaii
Got a little time last night to add MetaWebLogApi to my Blog in hopes of being able to start using slightly more favorable HTML in my posts. I've been using Word for all of my blogging over the years and while I've tried various tools for publishing posts I've always come back to the convenience of...
Medium Trust - WebPermissions and SmtpPermissions
March 06, 2007 - Maui, Hawaii
I'm putting the final touches on generic application that will be redistributed and one issue that I'm fretting over is dealing with some medium trust limitations in relation to Web access.
ASP.NET Projects to WAP conversion
February 26, 2007 - Maui, Hawaii
I've had several people contact me recently regarding issues in upgrading their projects to Web Application Project from stock ASP.NET 2.0 projects. While the process is fairly straight forward, there are a few gotchas worth mentioned here.
ASP.NET Caching under Memory Pressure
February 23, 2007 - Maui, Hawaii
On my server most of my apps are failing to store content in the ASP.NET Cache, most likely because the memory usage is pretty high and memory available is low.
February 14, 2007 - Maui, Hawaii
More on GZip compression with ASP.NET Content
February 05, 2007 - Maui, Hawaii
Now that GZip is natively available in .NET 2.0 it's very easy to compress your ASP.NET content with GZip compression.
wwHoverPanel ASP.NET AJAX Control updated
January 30, 2007 - Maui, Hawaii
I've updated the wwHoverPanel AJAX control to version 1.60. There are a number of new features which are mentioned in this post.
Update to free Web Configuration Utility
January 25, 2007 - Maui, Hawaii
I've updated my Web Configuration Utility with better support for IIS 7 and configuring .NET versions for a given Web Virtual.
January 23, 2007 - Maui, Hawaii
Finally got around to building a GZip script compression module for my library so I can start to quit worrying so much about script size. Here are some details on the module, how it works and how it's implemented.
Detecting ASP.NET Debug mode
January 19, 2007 - Maui, Hawaii
Here's a quickie: How do you detect if an ASP.NET application is running in debug mode?
IIS Root Web and web.config Inheritance - grrrrrr...
January 14, 2007 - Maui, Hawaii
While working on a module that installs on a root web I ran - once again - into a problem with the IIS web.config inheritance that causes the root web to propagate handler entries down into sub-virtuals which can cause serious problems.
RegisterClientScriptResource and the Type Parameter
December 26, 2006 - Maui, Hawaii
Usage of RegisterClientScriptResource's Type parameter can cause some unexpected behavior if you're using the all to common this.GetType() for a control. If multiple controls share the same resource be sure to use a common type or you might end up with multiple script references in your HTML
Update for the free wwHoverPanel AJAX Control posted
December 20, 2006 - Maui, Hawaii
I've posted another update to the free wwHoverPanel AJAX control that provides some useful new functionality and compatibility with MS Ajax.
DataTable/Set/Row support is back in MS Ajax RC
December 19, 2006 - Maui, Hawaii
Here are a couple of simple examples of how you can pass data between the server and client and back with MS Ajax using Web Services.
Visual Studio 2005 IntelliSense in ASP.NET pages issue resolved...
December 18, 2006 - Maui, Hawaii
I've been fighting with Visual Studio 2005 and Intellisense in ASP.NET pages for some time. As it turns out that
ScriptManager and Resource Compression
December 18, 2006 - Maui, Hawaii
The MS Ajax ScriptManager can automatically compress script files when using RegisterClientScriptResource. Unfortunately it only works when a script manager instance sits on a form even though the ScriptManager method is static.
UpdatePanels and ClientScript in custom Controls
December 12, 2006 - Maui, Hawaii
Due to changes in the MS Ajax Beta custom controls need to deal with the ClientScript object a bit differently if the control wants to be compatible with the MS Ajax UpdatePanel. It requires using the ScriptManager when available or using ClientScript when not.
Getting tripped by Absolute Positioning in custom Controls
December 11, 2006 - Maui, Hawaii
I ran into an issue today with a control that wasn't properly working in the designer when absolute positioning is used and the control couldn't be dragged around the designer surface.
Strongly typed Resources in ASP.NET
November 22, 2006 - Maui, Hawaii
If you’ve used WinForms application you might envy the fact that there you get strongly typed resources automatically for your RESX files – the Compiler automatically generates a class that contains each of the resources as a property of the class. Unfortunately this feature isn't available in ASP.NET. Here's why and a utility that can create you strongly typed resources that work.
.NET Web Services and Visual FoxPro COM Object Threading Issues
November 21, 2006 - Maui, Hawaii
I ran into an interesting issue today with a couple of ASMX Web Services that act as a front end for Visual FoxPro COM object for a client. The COM objects were blocking at times or worse in some cases cross talking and stepping on each other's environment. Turns out ASMX Web Services don't have an ASPCOMPAT flag so it takes some work to get Web Services to behave with STA components like those from Visual FoxPro
IP6 Addresses and Vista in ASP.NET
November 14, 2006 - Maui, Hawaii
Here’s a nice gotcha you might want to think about. Vista ships with IP Version 6 and this may in some situations affect how IP Addresses are returned by your Web applications. As part of my ASP.NET tools I have a request logging module that hooks into the pipeline and picks up and logs IP addresses which promptly started failing with IP6 addresses because they are too long.
ASP.NET Connections Fall 2006 Slides and Samples posted
November 12, 2006 - Maui, Hawaii
I’ve posted my slides and samples for my Fall 2006 ASP.NET Connections sessions online.
ASP.NET Connections Wrap-up
November 11, 2006 - Maui, Hawaii
Another conference behind me. Phew… I had a ton of fun this week at the Connections conference in Vegas, but as always it’s quite an experience to go through from my end.
My first MSDN Article: A Two-way DataBinding Extender Control for ASP.NET
November 09, 2006 - ASP.NET Connections, Las Vegas
So I was walking through the trade show here at the Connections conference today and ran by the MSDN booth and there it was: The December issue of MSDN Magazine, and in it my first article for the magazine. Woo hoo. It’s in the December issue and it’s about building the two-way databinding control...
ResourceProvider Localization Sample posted
November 05, 2006 - Maui, Hawaii
I’ve been talking for some time about about a localization provider I’ve been working on off and on for my session at ASP.NET Connections next week. I was finally able to post a small sample of what the provider does and what the admin interface looks like as part of my wwHoverPanel AJAX samples. The sample shows resource serving and resource editing in action.
October 31, 2006 - Maui, Hawaii
I'm finally getting to the point of actually using my localization provider and localizing a couple of applications, which as we all know is tedious as heck. Here are a few thoughts in how to deal with literal values placed into the ASP.NET page markup, especially in relation to creating script code literals.
Strongly typed resources in ASP.NET
October 31, 2006 - Maui, Hawaii
So I was screwing around today with strongly typed resources in ASP.NET. Another cool side-effect of using Web Application Projects as opposed to stock ASP.NET projects is that WAP uses strongly typed global resources. If you create a global resource file, WAP automatically creates a strongly typed...
Auto-Culture detection related issues in ASP.NET
October 30, 2006 - Maui, Hawaii
I've been mostly playing around with new Auto-Culture switching in ASP.NET 2.0 and it seems that there are a coulpe of issues I've run into that I can't seem to work around using this mechanism. I’ve posted about ways to switch cultures in code previously and that’s been working fine, but...
Creating and writing ASP.NET 2.0 custom Configuration Sections
October 29, 2006 - Maui, Hawaii
I had a few false starts when trying to update a custom Configuration Section in web.config today. It's super easy to create sections and read the values, but writing turned out to be a little more tricky due to lack of documentation.
ListControl SelectedValue inconsistencies
October 28, 2006 - Maui, Hawaii
I really dislike the ListControl SelectedValue implementation – this damn property is causing me all sorts of grief on occasion with its inconsistencies.
wwHoverPanel Update to co-exist with MS AJAX
October 25, 2006 - Maui, Hawaii
I’ve posted a small update to the wwHoverPanel control today that fixes a couple of small problems if used in combination with MS Ajax beta.
Common Problems with rendering Bitmaps into ASP.NET OutputStream
October 19, 2006 - Maui, Hawaii
Rendering image output in ASP.NET is not always straight forward as there are situations where images cannot be directly rendered into the Response.OutputStream
Packaging ASP.NET ASPX Pages into a separate Assembly
October 18, 2006 - Maui, Hawaii
I was thinking about deploying some administration pages for a component I've built recently and it came to me that it'd be nice to be able to package the admin pages as part of an assembly rather than forcing installation of a bunch of support files. It turns out using Web Deployment Projects it's possible to accomplish this at least at first glance with very little effort.
Properly overriding the Width Property of Web Control?
October 15, 2006 - Maui, Hawaii
If I have a control that inherits say from a Panel control (which basically generates a <div>) and I want to override...
LosFormatter for easy Serialization
October 13, 2006 - Maui, Hawaii
Ah, the ASP.NET LosFormatter – it’s a wonderful thing. I’m working on this resource provider and one of the things it has to do is deal with resources other than strings. There are a examples in several places that do a really half assed job of dealing with object resources that either don’t work. The LosFormatter makes this all so much easier.
ResoureProvider, ResourceManagers Relationships in ASP.NET 2.0
October 12, 2006 - Maui, Hawaii
I’ve been chomping away at my custom resource provider/manager and I have most of this working nicely with the ability to dynamically update resource content which was the original goal of this whole process. But even as all of this is coming together I still feel a bit lost on the high...
Odd problem with ASP.NET Caching and a CAPTCHA Control
October 10, 2006 - Maui, Hawaii
I've run into an odd problem with a third party Captcha control I use in my app where it appears that the ASP.NET Cache is dumping items almost immediately after they're added.
Recycling an ASP.NET Application from within
October 08, 2006 - Maui, Hawaii
In most situations developers want to minimize the amount of ASP.NET Application cycling that occurs, but I've found a few situations where it's actually quite useful to force the ASP.NET application cycle from within the application itself. Here's how...
Trying to implement IImplicitResourceProvider
October 06, 2006 - Maui, Hawaii
I'm still trying to implement a custom Localization provider and while I've made the base functionality work fairly easily I'm stuck on the IImplicitResourceProvider interface not being quite sure where it needs to go and what it EXACTLY needs to do. I have it firing but it's not working correctly...
Custom Localization ResourceProviders and Compiler Errors
October 04, 2006 - Maui, Hawaii
I’ve been struggling with building a custom ResourceManager and hooking it into ASP.NET over the last few days as part of a localization engine that is data driven rather than through Resources. I’ve had a separate engine for this for sometime, but it hasn’t been hooked into the .NET or ASP.NET...
The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.
September 30, 2006 - Maui, Hawaii
Whoa, a whacky ASP.NET error showed up on the WebLog Error log sometime this evening generating a boat load of errors rather quickly.
Compilation and Deployment in ASP.NET 2.0 Article posted
September 28, 2006 - Maui, Hawaii
I’ve posted a new looong article on Compilation and Deployment with ASP.NET 2.0 in the Articles section of the site. This article also ran in CoDe magazine this month: Compilation and Deployment in ASP.NET 2.0Compilation and deployment in ASP.NET 2.0 has brought some of the biggest changes to the...
Thread Aborted exception with a Thread Timer fired in ASP.NET
September 27, 2006 - Maui, Hawaii
I'm working on an app that uses a Thread Timer in an ASP.NET application to fire of a 'scheduled' recurring task that processes some slow running IO requests in a queued fashion. The concept works fine on my dev box, but unfortunately on the live server the timer thread aborts somewhere in the processing...
Web Application Projects and Visual Studio under Vista RC1
September 27, 2006 - Maui, Hawaii
I’ve been working for the last couple of days with some code in Web Application Projects under Vista RC1 and I am having nothing but problems with the Visual Studio Web Designer...