ASP.NET News from Blogger: Rick Strahls WebLog   Get the feed of: Rick Strahls WebLog

Total News: 801

DropDownList and SelectListItem Array Item Updates in MVC

So I ran into an interesting behavior today as I deployed my first MVC 4 app tonight. I have a list form that has a filter drop down that allows selection of categories. This list is static and rarely...

Passing multiple POST parameters to Web API Controller Methods

ASP.NET Web API introduces a new API for creating REST APIs and making AJAX callbacks to the server. This new API provides a host of new great functionality that unifies many of the features of many o...

Amazon Product Advertising API SOAP Namespace Changes

About two months ago (twowards the end of February 2012 I think) Amazon decided to change the namespace of the Product Advertising API. The error that would come up was: <ItemSearchResponse xmlns='...

GZip/Deflate Compression in ASP.NET MVC

A long while back I wrote about GZip compression in ASP.NET. In that article I describe two generic helper methods that I've used in all sorts of ASP.NET application from WebForms apps to HttpModules ...

Internet Explorer and Cookie Domains

I've been bitten by some nasty issues today in regards to using a domain cookie as part of my FormsAuthentication operations. In the app I'm currently working on we need to have single sign-on that sp...

Getting a 'base' Domain from a Domain

Here's a simple one: How do you reliably get the base domain from full domain name or URI? Specifically I've run into this scenario in a few recent applications when creating the Forms Auth Cookie in ...

ASP.NET MVC Postbacks and HtmlHelper Controls ignoring Model Changes

So here's a binding behavior in ASP.NET MVC that I didn't really get until today: HtmlHelpers controls (like .TextBoxFor() etc.) don't bind to model values on Postback, but rather get their value dire...

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

The Web can be an evil place, especially if you're a Web Developer blissfully unaware of Cross Site Script Attacks (XSS). Even if you are aware of XSS in all of its insidious forms, it's extremely com...

Odd MVC 4 Beta Razor Designer Issue

This post is a small cry for help along with an explanation of a problem that is hard to describe on twitter or even a connect bug and written in hopes somebody has seen this before and any ideas on w...

Physical Directories vs. MVC View Paths

This post falls into the bucket of operator error on my part, but I want to share this anyway because it describes an issue that has bitten me a few times now and writing it down might keep it a littl...

Creating a JSONP Formatter for ASP.NET Web API

Out of the box ASP.NET WebAPI does not include a JSONP formatter, but it's actually very easy to create a custom formatter that implements this functionality. JSONP is one way to allow Browser based J...

ASP.NET Web API and Simple Value Parameters from POSTed data

In testing out various features of Web API I've found a few oddities in the way that the serialization is handled. These are probably not super common but they may throw you for a loop. Here's what I ...

Dynamic JSON Parsing in .NET with JsonValue

So System.Json has been around for a while in Silverlight, but it's relatively new for the desktop .NET framework and now moving into the lime-light with the pending release of ASP.NET Web API which i...

.NET 4.5 is an in-place replacement for .NET 4.0

With the betas for .NET 4.5 and Visual Studio 11 and Windows 8 shipping many people will be installing .NET 4.5 and hacking away on it. There are a number of great enhancements that are fairly transpa...

Using an alternate JSON Serializer in ASP.NET Web API

The new ASP.NET Web API that Microsoft released alongside MVC 4.0 Beta last week is a great framework for building REST and AJAX APIs. I've been working with it for quite a while now and I really like...

Removing the XML Formatter from ASP.NET Web API Applications

ASP.NET Web API's default output format is supposed to be JSON, but when I access my Web APIs using the browser address bar I'm always seeing an XML result instead. When working on AJAX application I ...

Using the HTML5 <input type="file" multiple="multiple"> Tag in ASP.NET

Per HTML5 spec the <input type="file" /> tag allows for multiple files to be picked from a single File upload button. This is actually a very subtle change that's very useful as it makes it mu...

Make your CHM Help Files show HTML5 and CSS3 content

The HTML Help 1.0 specification aka CHM files, is pretty old. In fact, it's practically ancient as it was introduced in 1997 when Internet Explorer 4 was introduced. Html Help 1.0 is basically a compl...

Creating a dynamic, extensible C# Expando Object

I love dynamic functionality in a strongly typed language because it offers us the best of both worlds. In C# (or any of the main .NET languages) we now have the dynamic type that provides a host of d...

Dynamic Types and DynamicObject References in C#

I've been working a bit with C# custom dynamic types for several customers recently and I've seen some confusion in understanding how dynamic types are referenced. This discussion specifically centers...

Unable to cast transparent proxy to type <type>

This is not the first time I've run into this wonderful error while creating new AppDomains in .NET and then trying to load types and access them across App Domains. In almost all cases the problem I'...

IE9 not rendering box-shadow Elements inside of Table Cells

Ran into an annoying problem today with IE 9. Slowly updating some older sites with CSS 3 tags and for the most part IE9 does a reasonably decent job of working with the new CSS 3 features. Not all by...

XmlWriter and lower ASCII characters

Ran into an interesting problem today on my CodePaste.net site: The main RSS and ATOM feeds on the site were broken because one code snippet on the site contained a lower ASCII character (CHR(3)). I d...

Changing the default HTML Templates to HTML5 in Visual Studio

If you're using Visual Studio 2010 to create Web applications, you probably have found out that the default Web templates for ASP.NET Web Forms and Master pages and plain HTML pages all create HTML 4 ...

Debugging Application_Start and Module Initialization with IIS and Visual Studio

Recently I've seen quite a few questions pop up in regards to debugging ASP.NET application initialization. Most commonly I see something along these lines: I'm trying to debug my ASP.NET application...

HTML 5 Input Types on WebForms Controls

Did you know that you can use HTML5 input types with ASP.NET WebForms controls? I wasn't sure until I tried it today:<asp:TextBox runat="server" ID="Username" Width="250px" type="email" /&...

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

HTML5 introduces a number of new input types that are meant to provide a richer user input experience. It seems like this should be a good thing, given that we've basically been stuck with a very smal...

A Key Code Checker for DOM Keyboard Events

If you've ever written some code that needs to deal with individual keystrokes entered and to 'translate' or parse them, you've probably figured out that while on the surface it all looks pretty easy ...

Creating a Dynamic DataReader for easier Property Access

I've been thrown back to using plain old ADO.NET for a bit in a legacy project I'm helping one of my customers with and in the process am finding a few new ways to take advantage of .NET 4 language fe...

jQuery Time Entry with Time Navigation Keys

So, how do you display time values in your Web applications? Displaying date AND time values in applications is lot less standardized than date display only. While date input has become fairly univers...

Creating a Dynamic DataRow for easier DataRow Syntax

I've been thrown back into an older project that uses DataSets and DataRows as their entity storage model. I have several applications internally that I still maintain that run just fine (and I someti...

Dynamically creating a Generic Type at Runtime

I learned something new today. Not uncommon, but it's a core .NET runtime feature I simply did not know although I know I've run into this issue a few times and worked around it in other ways. Today t...

Using the West Wind Web Toolkit to set up AJAX and REST Services

I frequently get questions about which option to use for creating AJAX and REST backends for ASP.NET applications. There are many solutions out there to do this actually, but when I have a choice - no...

SnagIt Live Writer Plug-in Updated

Ah, I love SnagIt from TechSmith and I use the heck out of it almost every day. So no surprise that I've decided some time ago to integrate SnagIt into a few applications that require screen shots ext...

Loading jQuery Consistently in a .NET Web App

One thing that frequently comes up in discussions when using jQuery is how to best load the jQuery library (as well as other commonly used and updated libraries) in a Web application. Specifically the...

An easy way to create Side by Side registrationless COM Manifests with Visual Studio

Here's something I didn't find out until today: You can use Visual Studio to easily create registrationless COM manifest files for you with just a couple of small steps. Registrationless COM lets you ...

An easy way to create Side by Side COM Manifests with Visual Studio

Here's something I didn't find out until today: You can use Visual Studio to easily create registrationless COM manifest files for you with just a couple of small steps. Registrationless COM lets you ...

Getting a Web Resource Url in non WebForms Applications

WebResources in ASP.NET are pretty useful feature. WebResources are resources that are embedded into a .NET assembly and can be loaded from the assembly via a special resource URL. WebForms includes a...

An Xml Serializable PropertyBag Dictionary Class for .NET

I don't know about you but I frequently need property bags in my applications to store and possibly cache arbitrary data. Dictionary<T,V> works well for this although I always seem to be hunting...

Show raw Text Code from a URL with CodePaste.NET

I introduced CodePaste.NET more than 2 years ago. In case you haven't checked it out it's a code-sharing site where you can post some code, assign a title and syntax scheme to it and then share it wit...

Figuring out the IIS Version for a given OS in .NET Code

Here's an odd requirement: I need to figure out what version of IIS is available on a given machine in order to take specific configuration actions when installing an IIS based application. I build se...

FireFox 6 Super Slow? Cache Settings Corruption

For those of you that follow me on Twitter, you've probably seen some of my tweets regarding major performance problems I've seen with the install of FireFox 6.0. FireFox 6.0 was released a couple of ...

Translating with Google Translate without API and C# Code

Some time back I created a data base driven ASP.NET Resource Provider along with some tools that make it easy to edit ASP.NET resources interactively in a Web application. One of the small helper feat...

Opening the Internet Settings Dialog and using Windows Default Network Settings via Code

Ran into a question from a client the other day that asked how to deal with Internet Connection settings for running  HTTP requests. In this case this is an old FoxPro app and it's using WinInet ...

COM ByteArray and Dynamic type issues in .NET

In .NET 4.0 the dynamic type has made it A LOT easier to work with COM interop components.  I'm still working quite a bit with customers that need to work with FoxPro COM objects in .NET and ther...

Getting the innermost .NET Exception

Here's a trivial but quite useful function that I frequently need in dynamic execution of code: Finding the innermost exception when an exception occurs, because for many operations (for example Refle...

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

If you're running on IIS 7 and a 64 bit operating system you might run into the following error using ASP classic or ASP.NET with COM interop. In classic ASP applications the error will show up as: A...

Building a jQuery Plug-in to make an HTML Table scrollable

Today I got a call from a customer and we were looking over an older application that uses a lot of tables to display financial and other assorted data. The application is mostly meta-data driven with...

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

IIS 7 improves internal compression functionality dramatically making it much easier than previous version to take advantage of compression thats built-in to the Web server. Unlike IIS 6 which support...

Restricting Input in HTML Textboxes to Numeric Values

Ok, heres a fairly basic one how to force a textbox to accept only numeric input. Somebody asked me this today on a support call so I did a few quick lookups online and found the solutions listed rat...

View Other bloggers