WebLog Posts in Category ASP.NET

Right To Left (RTL) Text Display in Angular and ASP.NET
Yesterday @ 5:42pm

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 @ 9:53am

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 @ 4:53am

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 @ 4:29am

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 @ 1:19am

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 @ 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.

West Wind WebSurge - an easy way to Load Test Web Applications
July 15, 2014 @ 2:06am

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 @ 9:13pm

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 @ 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.

Forms Auth loginUrl not working after Windows Update?
February 15, 2014 @ 3:15am

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 @ 8:42pm

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 @ 11:12am

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 @ 3:46pm

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 @ 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.

Publish Individual Files to your Server in Visual Studio 2012.2
May 10, 2013 @ 2:29am

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 @ 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.

Set-Cookie Headers getting stripped in ASP.NET HttpHandlers
November 29, 2012 @ 5:38pm

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 @ 5:20am

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 @ 2:24am

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 @ 1:53am

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 @ 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.

Getting a 'base' Domain from a Domain
April 24, 2012 @ 9:17pm

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 @ 3:30am

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 @ 1:51am

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 @ 1:54am

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 @ 4:55am

In this post I describe how to use the West Wind Web Toolkit to create an AJAX/REST service that can serve data to a JavaScript applications with a few short steps. Then we'll look at ways to access the server side code with simple jQuery/JavaScript code and the ajaxCallMethod() helper.

Figuring out the IIS Version for a given OS in .NET Code
September 18, 2011 @ 7:50pm

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 @ 1:21pm

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 @ 1:50am

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 @ 1:17am

I have the need to monitor movement of elements in an HTML document via JavaScript. Unfortunatey there are no events that fire if HTML elements are moved around the document either via dragging or by programmatic location changes. As a workaround I created a jQuery CSS monitoring plugin that fires event when a given CSS property changes.

Allowing Access to HttpContext in WCF REST Services
January 10, 2011 @ 1:02pm

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 @ 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.

Microsoft and jQuery
November 01, 2010 @ 1:51pm

The jQuery JavaScript library has been steadily getting more popular and with recent developments from Microsoft, jQuery is also getting ever more exposure on the ASP.NET platform including now directly from Microsoft. jQuery is a light weight, open source DOM manipulation library for JavaScript that has changed how many developers think about JavaScript. You can download it and find more...

Using jQuery to POST Form Data to an ASP.NET ASMX AJAX Web Service
September 07, 2010 @ 10:40pm

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 @ 1:40pm

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 @ 12:16am

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 @ 4:35am

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 @ 1:55pm

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 @ 3:26am

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 @ 1:20am

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 @ 12:15am

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 @ 4:54am

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 @ 9:47am

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 @ 3:58pm

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 @ 5:52pm

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 @ 12:48am

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 @ 9:15pm

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 @ 8:31pm

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 @ 3:21am

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.

Introducing CodePaste.NET
July 21, 2009 @ 3:28am

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 @ 9:03pm

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 @ 12:31pm

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 @ 6:27pm

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 @ 1:59pm

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 @ 7:38pm

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 @ 1:18pm

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.

A Localization Handler to serve ASP.NET Resources to JavaScript
April 02, 2009 @ 1:08pm

Here's an implementation of an HTTP handler that can serve ASP.NET Server resources to JavaScript clients easily. The handler can provide both local and global, normalized server resources to client JavaScript pages so that you can localize resources in one place on the server. Use standard Resx resources or our custom database resource provider.

Updated Westwind.Globalization Data Driven Resource Provider for ASP.NET
April 01, 2009 @ 3:27am

I've updated the ASP.NET Data Driven Resource Provider code base and examples. There are a number of small improvements based on user feedback as well as a few new features like a new JavaScript Resource Handler that can provide server resources to JavaScript code easily.

Getting an ASP.NET Application Relative Path from a Logical Path
March 28, 2009 @ 4:33pm

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 @ 7:23pm

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 @ 1:30am

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 @ 12:00am

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 @ 3:32am

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 @ 4:27pm

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 @ 2:26am

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 @ 2:10pm

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 @ 12:45am

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 @ 12:59pm

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 @ 2:28am

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 @ 2:04pm

I've posted Part 1 in a two part series on jQuery today. Part 1 covers the client side features of jQuery from the basics all the way through creating simple plugins and extending jQuery. This is a long article that discusses a host of the really useful features that jQuery brings to the table for client side Javascript development. Part 2 will then follow up with server side ASP.NET integration.

Browser Rendering Differences and Browser Resets
September 24, 2008 @ 5:31pm

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 @ 4:55am

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 @ 4:05am

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 @ 1:39am

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 @ 2:31am

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 @ 1:54am

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 @ 2:12pm

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 @ 3:05am

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 @ 7:04pm

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 @ 2:54pm

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 @ 1:53am

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 @ 4:00pm

.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 @ 8:42am

I'll be doing my annual presentation at the Portland Area .NET User Group (PADNUG). The topic this time around is Using jQuery with ASP.NET which is a fun presentation that covers JavaScript and specifically jQuery use with ASP.NET without using ASP.NET Ajax. Here's the presentation abstract: Using jQuery with ASP.NET jQuery is a compact and powerful JavaScript library that is quickly becoming...

West Wind Ajax Toolkit updated
July 15, 2008 @ 12:46pm

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 @ 12:19am

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 @ 5:58am

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 @ 12:36am

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 @ 3:54am

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 @ 3:18am

jQuery is a small, yet very powerful and extremely addictive JavaScript library, that's rescued me from my JavaScript phobia I've had for many years. Although I've dabbled for years off and on with JavaScript I've not really had any joy with it until I started using jQuery. Here is my take on why this library is such a kick ass tool to have in your Web development toolkit.

1 comment
jQuery.ui Sortable
April 28, 2008 @ 12:59am

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 @ 12:52pm

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 @ 7:56pm

.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 @ 1:26am

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 @ 4:22am

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 @ 3:21am

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 @ 3:23am

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 @ 12:45am

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 @ 3:30am

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 @ 1:53pm

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 @ 12:05am

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.

Embedding ASP.NET Server Variables in Client JavaScript, Part 2
February 21, 2008 @ 3:47am

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.

Embedding ASP.NET Server Variables in Client JavaScript
February 12, 2008 @ 2:23am

Getting Server Variables embedded into a page and using them from JavaScript code can be a pain. Following Jon Galloway's post a few days ago I thought that maybe a more generic solution that doesn't rely on ASP.NET AJAX and is more generic might be useful to make the task easier and apply much broader scope. The result is an easy to use, generic class that generates a JavaScript object from key value pairs created on the server with static values or dynamic control or object properties.

jQuery Intellisense in Visual Studio
February 11, 2008 @ 12:51am

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 @ 7:58pm

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 @ 1:55am

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 @ 1:26am

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 @ 2:08am

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 @ 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...

Doing away with an Assembly Dependency
January 12, 2008 @ 6:37pm

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 @ 4:12pm

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 @ 2:56pm

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 @ 12:19am

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 @ 9:01am

.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.

ClientScriptProxy and JavaScript Linking In Headers
December 27, 2007 @ 7:46pm

.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 @ 7:35am

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 @ 12:28am

I was reviewing some control and handler code in my wwHoverPanel control's AJAX callback handler code. There are a number of routines that generate JavaScript output from JSON to returning resources and I noticed that the content type headers would often vary slightly. When returning a content type...

Updated jQuery Calendar to jQuery DatePicker
December 21, 2007 @ 3:14pm

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 @ 12:59am

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 @ 1:49am

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 @ 1:44am

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 @ 5:25pm

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 @ 3:37am

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 @ 1:52pm

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 @ 4:59am

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 @ 1:20am

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 @ 2:18am

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 @ 7:15pm

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 @ 12:01am

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 @ 3:43am

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 @ 12:31am

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 @ 7:43pm

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 @ 7:33pm

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 @ 12:43am

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 @ 1:49am

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 @ 3:07pm

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 @ 8:57pm

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 @ 12:17am

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 @ 12:32am

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 @ 12:50am

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 @ 12:19am

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 @ 12:30am

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 @ 1:30am

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 @ 11:05am

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 @ 1:26am

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 @ 4:23pm

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...

Embedding JavaScript Strings from an ASP.NET Page
July 14, 2007 @ 3:06am

I'm looking at a piece of code that's a custom control that embeds a bit of JavaScript into a page. Part of this JavaScript is generating some static string text directly into the page. I've been running this code for a while now as part of an application I'm working on with a customer. But a...

GoDaddy and SocketPermissions
July 11, 2007 @ 1:29pm

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 @ 4:15pm

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 @ 1:10pm

Here's the JSONP code that uses the code I mentioned in my last post. JSONP is an unofficial protocol that allows making cross domain calls by generating script tags in the current document and expecting a result back to calls a specified callback handler. The client JavaScript code to make a JSONP...

wwHoverPanel ASP.NET Ajax Control Update
July 03, 2007 @ 12:38am

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...

1 comment
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...

Images as Style Attributes
June 29, 2007 @ 12:45am

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...

ConfigSection Security
June 27, 2007 @ 12:10am

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 @ 5:52pm

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 @ 12:45am

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 @ 3:53pm

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...

IIS 7 and JavaScript Compression not working consistently
June 22, 2007 @ 2:36am

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 @ 8:51pm

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 @ 2:43am

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 @ 7:42pm

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 @ 7:28pm

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 @ 8:15pm

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 @ 2:06pm

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 @ 12:05pm

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 @ 4:21pm

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...

Gravatar Implementation
May 16, 2007 @ 11:14pm

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 @ 3:41pm

I'm working on some JavaScript code for my library that does drag and drop. It's working pretty well and I'd been testing most of my code against dragging around Div tags with drag handles and content which works great. However, depending on how even bubbling is set up in certain browsers the...

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...

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...

Dynamically hooking up HttpModules
April 06, 2007 @ 1:09am

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 @ 3:13pm

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 @ 7:01pm

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 @ 5:35am

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 @ 2:16pm

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 @ 11:23pm

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 @ 11:36pm

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 @ 3:36pm

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 @ 2:55pm

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 @ 10:32pm

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.

Evaluating JavaScript code from C#
February 14, 2007 @ 12:10am

.NET includes support for JavaScript as a .NET language, but it's not talked about a lot. More interesting though is that you can access the JavaScript runtime from your C#/VB.NET code and it's pretty easy to do although it's not well documented. Here are a few starter scenarios...

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.

wwHoverPanel ASP.NET AJAX Control updated
January 30, 2007 @ 2:58am

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 @ 5:06am

I've updated my Web Configuration Utility with better support for IIS 7 and configuring .NET versions for a given Web Virtual.

Building a GZip JavaScript Resource Compression Module for ASP.NET
January 23, 2007 @ 2:15am

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 @ 9:00pm

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 @ 6:52am

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 @ 3:37pm

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 @ 1:34am

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 @ 4:23am

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 @ 2:58pm

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 @ 5:14am

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 @ 4:03am

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 @ 1:54am

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 @ 12:37am

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 @ 1:44pm

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 @ 2:33pm

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 @ 12:20am

I’ve posted my slides and samples for my Fall 2006 ASP.NET Connections sessions online.

ASP.NET Connections Wrap-up
November 11, 2006 @ 3:42pm

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 @ 11:59am

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 @ 1:23pm

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.

Accessing Localized values in ASP.NET markup and JavaScript
October 31, 2006 @ 6:59pm

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 @ 2:57am

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...

1 comment
Auto-Culture detection related issues in ASP.NET
October 30, 2006 @ 3:21am

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 @ 12:37pm

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 @ 7:33pm

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 @ 10:04pm

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.

1 comment
Common Problems with rendering Bitmaps into ASP.NET OutputStream
October 19, 2006 @ 5:36pm

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 @ 4:29am

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 @ 12:08am

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 @ 4:17am

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 @ 6:18pm

 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 @ 2:43am

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 @ 8:03pm

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 @ 1:03am

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 @ 2:36pm

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 @ 5:13am

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 @ 3:08am

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 @ 6:12am

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 @ 5:13am

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...