Rick Strahl's Web Log
Wind, waves, code and everything in between...
WebLog Posts in Category MVC
ASP.NET MVC HttpVerbs.Delete/Put Routes not firing
April 09, 2015 @ 1:23pm
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.
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.
Project Navigation and File Nesting in ASP.NET MVC Projects
June 30, 2014 @ 10:28pm
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
June 18, 2014 @ 1:37am
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.
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.
IIS Default Documents vs. ASP.NET MVC Routes
August 15, 2013 @ 8:38pm
ASP.NET MVC's routing takes over extensionless URLs and if you want to serve static default document using IIS's default settings you need to make sure you ignore the default route.
Rendering ASP.NET MVC Razor Views outside of MVC revisited
July 15, 2013 @ 1:48pm
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.
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.
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.
GZip/Deflate Compression in ASP.NET MVC
April 28, 2012 @ 4:00am
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.
ASP.NET MVC Postbacks and HtmlHelper Controls ignoring Model Changes
April 20, 2012 @ 2:19am
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.
Odd MVC 4 Beta Razor Designer Issue
April 14, 2012 @ 12:54pm
I have an odd designer issue with MVC 4 Razor pages which are causing errors in the environment.
Physical Directories vs. MVC View Paths
April 05, 2012 @ 2:38pm
Physical directories that map paths that are also mapped by ASP.NET MVC routes can cause some consternation, especially if you're not aware that there's pathing overlap between the two. This post is a story about an operator error episode of an accidental file move that took a while to trace down due physical path interference.
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.
Getting a Web Resource Url in non WebForms Applications
October 05, 2011 @ 3:29am
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.
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.
Odd/Even Looping in ASP.NET MVC
August 31, 2009 @ 8:54pm
Creating lists that have alternating display characteristics for alternating content are common and in MVC you have to do a little bit more work to make this happen. Here's an easy way to represent the expression using a boolean variable.
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.
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.
Url.Action() and RouteValue Encoding
July 19, 2009 @ 5:21pm
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.
April, 2015 (2)
March, 2015 (5)
February, 2015 (4)
January, 2015 (5)
December, 2014 (3)
November, 2014 (2)
October, 2014 (3)
September, 2014 (2)
August, 2014 (1)
July, 2014 (2)
June, 2014 (4)
May, 2014 (3)
April, 2014 (1)
March, 2014 (2)
February, 2014 (2)
January, 2014 (3)
December, 2013 (4)
November, 2013 (5)
October, 2013 (4)
September, 2013 (3)
August, 2013 (2)
July, 2013 (3)
June, 2013 (4)
May, 2013 (2)
Visual Studio (38)
Web Services (17)
Web Api (16)
Microsoft AJAX (8)
Web Connection (7)
Sql Server (7)
West Wind Ajax Toolkit (7)
Live Writer (5)
Entity Framework (5)
Html Help Builder (5)
Visual Studio (4)
Source Control (4)
Software Development (3)
Help Builder (3)
Internet Explorer (2)
ASP.NET vNext (2)
Web Deployment Projects (1)
Web Design (1)
Control Development (1)
Dynamic Types (1)
© Rick Strahl, West Wind Technologies, 2005 - 2015