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 MVC

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

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.

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.

401 Response from ASP.NET Identity when linking to External Accounts

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.

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.

ASP.NET MVC, Localization and Westwind.Globalization for Db Resources

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

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.

Creating ASP.NET MVC Negotiated Content Results

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

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

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

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

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

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

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

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

I have an odd designer issue with MVC 4 Razor pages which are causing errors in the environment.

Physical Directories vs. MVC View Paths

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

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

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

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

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

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

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

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.
West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2017