Rick Strahl's Web Log

Wind, waves, code and everything in between...
ASP.NET • C# • HTML5 • JavaScript • AngularJs
Contact   •   Articles   •   Products   •   Support   •   Search
Ad-free experience sponsored by:
ASPOSE - the market leader of .NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more

WebLog Posts in Category ASP.NET

ASP.NET (236) .NET (120) JavaScript (71) jQuery (61) ASP.NET (60) Windows (50) AJAX (47) Visual Studio (44) CSharp (43) IIS (42) HTML (36) Localization (31) LINQ (30) Personal (30) WCF (28) MVC (25) HTML5 (23) ASP.NET Core (23) WPF (22) FoxPro (21) Web Services (19) Security (19) CSS (18) Web Api (16) COM (15) IIS7 (14) ADO.NET (13) C# (13) Angular (12) Vista (12) XML (10) HTTP (10) Sql Server (8) Microsoft AJAX (8) Web Connection (7) West Wind Ajax Toolkit (7) Entity Framework (6) C++ (5) Html Help Builder (5) ASPNET5 (5) Visual Studio (5) OWIN (5) SignalR (5) Silverlight (5) Live Writer (5) Mobile (4) NuGet (4) Source Control (4) Westwind.Globalization (4) .NET Core (4) IIS (4) .NET Core (4) ADO.NET (4) Angular (4) ISV (4) Cordova (4) Help Builder (3) Conferences (3) DataBinding (3) LetsEncrypt (3) IIS7 (3) Internet Explorer (3) Internet Explorer (3) Windows (3) WebLog (3) Software Development (3) Web Browser Control (3) Networking (3) Opinion (3) Razor (3) RegEx (2) RSS (2) Office (2) Speaking (2) Tools (2) WinForms (2) WinForms (2) WPF (2) .NET (2) ASP.NET vNext (2) ASP.NET Core (2) Installation (2) Help (2) Bugs (2) FireFox (1) Flexbox (1) Graphics (1) Hardware (1) Deployment (1) Dynamic Types (1) Control Development (1) Chocolatey (1) IOS (1) iPhone (1) JSON (1) Markdown (1) Markdown Monster (1) Maui (1) C# (1) FoxPro (1) HTML5 (1) .NET Standard (1) Linux (1) Localization (1) Markdown Monster (1) Migration (1) RazorPages (1) Security (1) Typescript (1) Azure (1) ASP.NET Markdown (1) Addins (1) wwHoverPanel (1) Windsurfing (1) Travel (1) Testing (1) Threading (1) Web Deployment Projects (1) Web Design (1) Visual Studio Code (1) Musings (1) Linux (1) SEO (1)

Handling HTML5 Client Route Fallbacks in ASP.NET Core

HTML5 client routes work great on the client, but when deep linking into a site or pressing refresh in the browser, HTML5 client side routes have a nasty habit of turning into server HTTP requests. Requests to routes that the server is likely not configured for. In this post I look at why HTML5 client routes require server cooperation to handle and how to set them up on IIS and/or ASP.NET Core.

Running .NET Core Apps under Windows Subsystem for Linux (Bash for Windows)

The Windows Shell for Linux (WSL or Bash on Ubuntu on Windows) provides a nice way for Windows and Linux to interact without the overhead of dealing with a separate VM. Using the WSL you can now also run your .NET Core applications directly under Linux without requiring a VM or Docker. In this post I demonstrate how the shell works and how you can run your .NET and ASP.NET Core applications to test operation under Linux.

Updating my AlbumViewer Sample to ASP.NET Core 1.1 and Angular 4

I updated my AlbumViewer sample application recently to the latest versions of ASP.NET Core (1.1) and the new .csproj project as well Angular 4

New CODE Magazine Article: Getting down to Business with ASP.NET Core

The latest issue of CODE magazine features my `Getting down to Business with ASP.NET` Core article as the cover article. The article focuses on building an ASP.NET Core backend for an Angular 2 front application, covering all aspects of separating business and Web app logic, dealing with EF Core data access in related tables, CORS to be able to run across domains and simple authentication in a client centric REST service application. Check it out.

Google AdSense for AJAX Content

I recently redesigned one of my Web sites to use dynamic page re-loading for additional page content, which broke the original AdSense ad code. In this post I'll describe how to get AdSense ads to work with AJAX loaded content by explicitly calling Googles ad code from your dynamic navigation code.

Reversing Sort Order on DOM Elements using jQuery

When creating list content in Web pages, it's often quite useful to allow users to sort or reverse the order of items displayed. Creating client side sortable lists is easy to do and in this post Rick shows an easy way to make a list reversible using jQuery.

Microsoft renames ASP.NET 5 to ASP.NET Core 1.0

ASP.NET 5 has been renamed to ASP.NET Core 1.0 and in the process some major changes are happening to the framework very late in the release cycle. In this post I take a look at some of the concern I have when I see these drastic changes so late in the release cycle and some thoughts on how I've worked with ASP.NET Core so far and some of the trepidations I have moving forward.

A small jQuery Resizable Plug-in

I recently had a need for a simple resize component and couldn't find a lightweight implementation. I ended up creating a small jquery-resizable plug-in. In this post I discuss a few use cases for resizables and show the jquery-resizable plug-in, how it works and how it's implemented.

Serving URLs with File Extensions in an ASP.NET MVC Application

I ran into an issue trying to create a specific file URL for Windows Live Writer in an MVC application, where I needed to return a very specific file based URL with an extension from an MVC application. Turns out that this is not as easy as it sounds.

Mysteriously stubborn IIS 401.2 Errors

I ran into a nasty IIS issue yesterday that took me the better part of a day to get myself out of. It involved particularily stubborn Authentication requests from ASP.NET applications when there shouldn't have been any. It turns out the culprit was some corrupted config files - here's the why and how.

Rebooting Database Localization for ASP.NET with West Wind Globalization 2.0

I'm happy to announce the release of Westwind.Globalization version 2.0 - a database resource localization library for ASP.NET. Version 2 is a major upgrade that includes many new features including support for new database providers, a brand new Web Resource Editor, much improved ASP.NET MVC support, vastly better support for importing and exporting Resx resources, creating of strongly typed classes and much more. There's also a new video that describes features and provides a getting started guide with some detailed background. In this post I review some of the new features and point at additional resources for more information.

How to manage Content in NuGet Packages?

In getting ready to put out version 2 of Westwind.Globalization I've been rearranging the NuGet package layout a few times and I'm considering further breaking out the package layout. In this post I describe some of the dilemmas I'm looking at in deciding how much abstraction is required in breaking the NuGet packages into easily usable and maintainable components with the least amount of friction.

Interactive ASP.NET Resource Linking and Editing with Westwind.Globalization

Resource linking for resource editing is a very useful feature when localizing application, making it easy to jump back and forth between content and the resources that need to be edited. Seeing resource content in context is vital to good application localization. Westwind.Globalization provides a simple HTML based resource linking mechanism and in this post I describe how it works, and how it's implemented in the Westwind.Globalization library.

Adding minimal OWIN Identity Authentication to an Existing ASP.NET MVC Application

ASP.NET 4 provides a new Identity Authentication/Authorization framework that's very comprehensive and works reasonably well for new applications. However, if you have existing applications or use custom user management, it's not very clear how to use just the basic OWIN Authentication/Authorization layer without the full UserManager and Entity Framework implementation. In this post I describe how to use the bare minimum Identity features to hook up a custom domain model for both local and external logins in an ASP.NET MVC application.

ASP.NET MVC HttpVerbs.Delete/Put Routes not firing

If you're using ASP.NET MVC to build API endpoints in your application you might have run into a problem where the PUT and DELETE HTTP operations don't work - you get a 404 instead. Turns out that the IIS default configuration doesn't include the verbs for a required handler. Here's what the problem is, and how to fix it if it hits you.

Back to Basics: UTC and TimeZones in .NET Web Apps

Storing dates in persistent storage using UTC dates is a widely accepted best practice. But it's surprisingly complex using date data effectively if you want to let the user see dates and query data in their local time zone. Looking around I noticed that there's not a lot of comprehensive info on this topic, so I decided to take notes and write down some of the approaches I've used in this post. This post combines and overview and a number of helper routines specifically geared towards user timezone adjustments in typical ASP.NET Web applications.

Project Navigation and File Nesting in ASP.NET MVC Projects

Project navigation in large projects can be a pain as you have to sift through large amounts of files. I found myself re-organizing projects in a few different ways to make project navigation easier. In this blog post I share a few different approaches as well as some useful tooling to improve my daily workflow.

A dynamic RequireSsl Attribute for ASP.NET MVC

In ASP.NET MVC the RequireHttps attribute allows for securing controllers and controller methods, but it's limited to either on or off statically. In this post I discuss a custom attribute that can dynamically set SSL usage based on a configuration setting or delegate.

Updated ASP.NET Database Resource Provider

I've updated my database ASP.NET Resource Provider project into a more formal project with a new home page, and official GitHub repository for the source code as well as a getting started video. In this video I talk about what's new and a few examples on how to use the provider.

Auto Selecting Cultures for Localization in ASP.NET

When creating multi-language Web sites, one of the key issues you need to deal with is how to assign a culture to display the appropriate resources. Whether you need to auto-switch locales based on browser language, or explicitly assign a locale based on user preferences there is generally some code logic involved in making these decisions. In this post I show what options are available and a small helper that simplifies setting the culture in ASP.NET applications.

Re-examining ASP.NET and Helios Performance Tests

Spend a little time over the weekend re-running some of my ASP.NET raw throughput benchmarks on my new machine and found some interesting results. Much faster, but also some surprises with self-hosting and efficiency surprises with various Web API approaches.

Routes, Extensionless Paths and UrlEncoding in ASP.NET

When using custom routing in your ASP.NET applications be careful with encoding routes into paths. Specifically make sure that embedded route paths are properly encoded and that you watch out for a few gotchas related to path encoding. This post demonstrates how to set up routes for a WebForms app and demonstrates a couple of potential problems of manual route encodings and the fixes.

Use IIS Application Initialization for keeping ASP.NET Apps alive

Ever want to run a service-like, always-on application inside of ASP.NET instead of creating a Windows Service or running a Console application? Need to make sure that your ASP.NET application is always running and comes up immediately after an Application Pool restart even if nobody hits your site? The IIS Application Initialization Module provides this functionality in IIS 7 and later, making it much easier to create always-on ASP.NET applications that can act like a service.

Rendering ASP.NET MVC Razor Views outside of MVC revisited

Rendering ASP.NET MVC Views outside of the context of MVC can be immensely useful for various administration, error and logging tasks. Luckily there are some easy ways to render MVC even outside of an MVC controller. Here's some information on how to make that happen.

A first look at SignalR

Last month I finally had a chance to use SignalR in a live project for the first time, and I've been impressed by what this technology offers to .NET developers. It's easy to use and provides rich real-time two way messaging between client and server applications, as well as the ability to broadcast message to all connected clients. This is technology that offers many opportunities to rethink of what we can build with Web applications.

A small, intra-app Object to String Serializer

On a few occasions I've needed a very compact serializer for small and simple, flat object serialization, typically for storage in Cookies or a FormsAuthentication ticket in ASP.NET. XML and JSON serialization are too verbose for those scenarios so a simple property serializer that strings together the values was needed. Originally I did this by hand, but here is a class that automates the process.

Using plUpload to upload Files with ASP.NET

plUpload is a popular client side multi-file upload component. In this article I describe a small library that abstracts the server side processing of uploaded files with an HTTP handler demonstrate putting it all together with a small Image Upload sample application.

Visual Studio Web Publish Lockup? Check for invisible Window

If your Web Publish dialog appears to lock up Visual Studio when you click on the Publish option, most likely the Web Publish window is hidden on a second screen that is not currently visible. Here's how you can work around this annoying little bug.

Caveats with the runAllManagedModulesForAllRequests in IIS 7/8

IIS 7 and 8 support using Managed Modules to handle access to all IIS request content which is very powerful. But sometimes you actually want to not handle non-ASP.NET content and it's not very obvious how to minimize access to non-ASP.NET requests in managed modules.

Creating STA COM compatible ASP.NET Applications

When it comes to deploying STA COM components in ASP.NET only WebForms has native support for STA component. Other technologies like MVC, ASMX Web Services and WCF run only in MTA mode. If you need to run your STA COM Components in ASP.NET here is what you need to know and a few tools that help you create STA compatible handlers.

ASP.NET Frameworks and Raw Throughput Performance

I got curious the other day: How do the various ASP.NET framework compare in raw throughput performance? With so many development choices on the ASP.NET stack available today it's interesting to take an informal look at how raw throughput performance compares.

Rendering ASP.NET MVC Views to String

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

GZip/Deflate Compression in ASP.NET MVC

If you want to create ASP.NET MVC content that uses gzip or deflate compression you need to use some custom code. Here's an action filter that compresses content in your ASP.NET MVC applications.

Internet Explorer and Cookie Domains

Got tripped up today by another IE issue: Internet Explorer will not accept Cookies with local domains set for the Cookie Domain and fail silently.

ASP.NET MVC Postbacks and HtmlHelper Controls ignoring Model Changes

Today I discovered an MVC behavior I hadn't noticed: For HTML helper controls MVC always uses POSTBACK values to display the control value rather than model values when the View is rendering in a POST back. In effect this means that MVC Views can't update the value of controls during a POST back using the standard HTML Helper Controls.

Wishful Thinking: Why can't HTML fix Script Attacks at the Source?

I'm dealing with user HTML input in a Web application today and again I curse over the complexities involved in sanitizing this html. So today I started dreaming about a possible alternative...

Changing the default HTML Templates to HTML5 in Visual Studio

The default WebForms templates in Visual Studio still use the XHTML doctype headers by default. HTML5 doctype headers are easier to use and read and with HTML5 support now becoming mainstream and backward compatible with older browsers its time to switch those doctype headers. This post demonstrates how to change the default VS templates or create new templates altogether. With HTML becoming more prominent and the new headers being easier to read and smaller in size, it's

Debugging Application_Start and Module Initialization with IIS and Visual Studio

If you're running the full version of IIS and you try to debug your Web application's startup code in Application_Start you might have found that you can't debug this code as the debugger doesn't break there. Here's why and some easy ways you can work around this limitation.

HTML 5 Input Types - How useful is this really going to be?

The HTML 5 input controls enhancements seem like a nice feature - until you look a little closer and realize that that validation and styling these control enhancement use are likely going to interfere with your existing application logic and styling. Here are are some thoughts on the subject.

HTML 5 Input Types on WebForms Controls

HTML5 input types are new, and as it turns out ASP.NET Webforms input controls can easily create HTML5 input elements.

Loading jQuery Consistently in a .NET Web App

Loading jQuery into a page consistently across the lifetime of an application involves, managing versions and updating urls frequently. In this post I look at my preferred way to load jQuery and how to manage the script reference that gets embedded into the page with a single update location.

Getting a Web Resource Url in non WebForms Applications

Need to retrieve Web Resource Urls from a .NET assembly, but not running in WebForms? Here's how you can create a small helper function that lets you retrieve WebResourceUrls from Razor or MVC applications.

ActiveX component can't create Object Error? Check 64 bit Status

When moving applications to 64 bit servers be sure to check that you don't call old school, 32 bit COM objects. If you do these COM object calls fail. Thankfully IIS 7 and later allows Application Pool configuration to enable 32 bit operation to work around this issue. Here's how.

Built-in GZip/Deflate Compression on IIS 7.x

IIS 7.x makes content compression via GZip very easy. Here's how compression on IIS works and how you can set it up on your server in a few simple steps.

ASP.NET GZip Encoding Caveats

GZip and Deflate compression is easy to use in ASP.NET applications, but there are a few caveats that you need to watch out for. This post reviews the basics of implementing compression in ASP.NET code and describes a couple of scenarios that can cause problems when using programmatic compression via Response.Filter.

Error on 64 Bit Install of IIS – LoadLibraryEx failed on aspnet_filter.dll

Ran into a problem on my 64 bit machine with IIS trying to load 32 bit dlls. Turns out this is a misconfiguration that occurred from some additional installation that failed to set a specific bitness valuie and pointed to 32 bit install. Here's what happened and how it got fixed.

Custom ASP.NET Routing to an HttpHandler

Routing support in ASP.NET 4.0 has been vastly improved, but custom routing still involves a fairly complex process of creating RouteHandlers and mapping requests properly. In this post I show an example of how to create custom routes automatically via Attribute route mapping for Http Handler endpoints.

Changing an HTML Form's Target with jQuery

If you have multiple submit or link buttons in an ASP.NET Page and one or more of those buttons needs to post to a different target there's no built-in way to force one or more of those buttons to POST to a different frame/window. With a little bit of JavaScript though it's real easy to change the form's target dynamically as needed.

Retrieve the full ASP.NET Form Buffer as a String

How do you get the full Request.Form buffer in an ASP.NET request as a string? Here's how with a simple function.

WCF REST Service Activation Errors when AspNetCompatibility is enabled

Ran into a version problem with WCF REST Services when using on IIS and with ASP.NET Compatibility enabled. Turns out there's a potential version conflict in the system .config files that can cause this error to creep up - here's how to fix it.

A Closable jQuery Plug-in

I've found it very useful to have a closeable plug-in that hide the content of an HTML element providing a visual close image cue. Almost every UI I build these days requires either closing pop up windows or even more commonly requires that items are removed and visually hidden which usually implies 'close' behavior. In addition to removing a bunch of HTML markup, having a plug-in is also quite useful for server controls especially if multiple behaviors (plug-ins) need to be applied.

Adding proper THEAD sections to a GridView

ASP.NET's GridViews (and the older DataGrid) don't generate the best HTML and one of the common problems I run into is that headers aren't generated with proper thead tags. With a little jQuery script help this can be fixed easily when the page loads. Here's how.

Request Limit Length Limits for IIS’s requestFiltering Module

Got bit during an update today by code that ran just fine on my dev machine and failed on OpenID logins on the live machine. Turns out RequestFiltering was not allowing the long OpenID urls to be served, a problem that's easy to hit with the default settings in Windows Server 2008.

Microsoft Introduces WebMatrix

Microsoft recently released a preview of WebMatrix a tool geared towards hobby/non-developer types to build Web applications. This all in one environment is supposed to simplify Web development with having to be an expert. In this post I review some of the interesting features and how they stack up.

AspNetCompatibility in WCF Services – easy to trip up

When using ASP.NET compatiblity in WCF REST services you'll want to be very careful in matching your configuration settings and service attributes in the correct combination or you may end up with unpleasant and hard to find ServiceActivationExceptions.

HttpContext.Items and Server.Transfer/Execute

I got bitten by a the fact that the Context.Items collection stays active throughout the ENTIRE lifetime of an ASP.NET request including Server.Transfer and Execute calls. In certain situations this can cause big problems if you expect the items to be unique for the specific page/component request.

Speaking at the Portland Area .NET User Group on Tuesday Sept 1st

I’ll be speaking at the PADNUG meeting next week in Portland at the Microsoft office. Rich Hubbins asked me to present on jQuery again as I did last year. A lot has changed in the last year and when I gave the last presentation jQuery was just starting to get some attention in the .NET world. By now many more people have been using jQuery for a while so  this talk likely will hit a different...

Url.Action() and RouteValue Encoding

When creating custom URLs with the UrlHelper.Action() method is a great way to create links to other URLs in the current Web application. However, you need to be careful of certain encoding issues as certain characters are not correctly encoded to work properly as parameters.

Creating a quick and dirty jQuery contentEditable Plugin

Inline editing content is a feature that's novel and highly useful at the same time. I've been using it in a number of admin interfaces to provide very easy and quick text updates to existing content. There are a number of ways to accomplish this but in this post I'll discuss a contentEditable jQuery plugin that makes any content inline editable using the DOM's contentEditable attribute that maintains text formatting in the editable text.

Where's my .NET 3.5 (on IIS), Dude?

I just delivered a small 3.5 application to a  customer in compiled form and told him to install the application on IIS. The company is one I've dealt with on a few occasions and they are .NET aware shop where I deal with developers and a .NET familiar IT department. But it wasn't long after I sent my email that I got a call back from the customer who - slightly embarrassed - mentioned that they couldn't find the 3.5 Runtime option in the ASP.NET configuration panel.
West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2018