Articles : Page 6 of 7
- Filter:
- Routing
-
Putting the Con (COM1, LPT1, NUL, etc.) Back in your URLs
Apr 1029One annoyance that some developers have run into with ASP.NET MVC is that certain reserved filenames are not allowed in URLs. The specifics of this restriction are accounted for in an interesting blog post entitled Zombie Operating Systems and ASP.NET MVC. This actually wasn’t a restriction on ASP.NET MVC but was built into the core of ASP.NET itself. Fortunately, ASP.NET 4 fixes this issue with a new setting. In web.config, simply add <httpRuntime relaxedUrlToFileSystemMapping="true"/> to t...
-
Putting the Con (COM1, LPT1, NUL, etc.) Back in your URLs
Apr 1029One annoyance that some developers have run into with ASP.NET MVC is that certain reserved filenames are not allowed in URLs. The specifics of this restriction are accounted for in an interesting blog post entitled Zombie Operating Systems and ASP.NET MVC. This actually wasn’t a restriction on ASP.NET MVC but was built into the core of ASP.NET itself. Fortunately, ASP.NET 4 fixes this issue with a new setting. In web.config, simply add <httpRuntime relaxedUrlToFileSystemMapping="true"/> to t...
-
Sending JSON to an ASP.NET MVC Action Method Argument
Apr 1015Javier “G Money” Lozano, one of the good folks involved with C4MVC, recently wrote a blog post on posting JSON (JavaScript Object Notation) encoded data to an MVC controller action. In his post, he describes an interesting approach of using a custom model binder to bind sent JSON data to an argument of an action method. Unfortunately, his sample left out the custom model binder and only demonstrates how to retrieve JSON data sent from a controller action, not how to send the JSON to the action...
-
Editable MVC Routes (Apache Style)
Mar 1021Since writing yesterday’s post about what annoys me regarding the limited insight most web developers have in regards to Routing vs Rewriting. It occurred to me that I might be able to make the difference and benefits between the two more clear. After remembering a post by Phil Haack about Editable MVC Routes. By merging [...]...
-
ASP.NET MVC 2 Optional URL Parameters
Feb 1012If you have a model object with a property named Id, you may have run into an issue where your model state is invalid when binding to that model even though you don’t have an “Id” field in your form. The following scenario should clear up what I mean. Suppose you have the following simple model with two properties. public class Product { public int Id { get; set; } public string Name { get; set; } } And you are creating a view to create a new Product. In such a view, you obviously don’...
-
Translating routes (ASP.NET MVC and Webforms)
Jan 1026For one of the first blog posts of the new year, I thought about doing something cool. And being someone working with ASP.NET MVC, I thought about a cool thing related to that: lets do something with routes! Since System.Web.Routing is not limited to ASP.NET MVC, this post will also play nice with ASP.NET Webforms. But whats the cool thing? How about translating route values? Allow me to explain Im tired of seeing URLs like http://www.example.com/en/products and http://www.example.com/nl/pr...
-
Editable Routes Using App_Code
Jan 1018UPDATE: I’ve updated the original post for editable routes to work in medium trust and not require a full app domain reload like this approach does. I think that approach may supersede this approach until I learn otherwise. :) Yesterday I wrote about a technique using dynamic compilation to allow editing routes after you’ve deployed an application without having to manually recompile your application. I made use of a FileSystemWatcher to monitor a Config directory and dynamically recompile...
-
Editable Routes
Jan 1018UPDATE: I’ve updated this to work in Medium Trust without having to restart the entire App Domain using a technique proposed by my co-worker David Ebbo. I am no longer using the FileSystemWatcher which had problems in Medium Trust In general, once you deploy your ASP.NET MVC application, you can’t change the routes for your application without recompiling the application and redeploying the assembly where your routes are defined. This is partly by design as routes are generally considered ...
-
Ambiguous Controller Names With Areas
Jan 1012Note: This describes the behavior of ASP.NET MVC 2 as of the release candidate. It’s possible things might change for the RTM. When using areas in ASP.NET MVC 2, a common problem you might encounter is this exception message. The controller name 'Home' is ambiguous between the following types: AreasDemoWeb.Controllers.HomeController AreasDemoWeb.Areas.Blogs.Controllers.HomeController This message is telling you that the controller factory found two types that match the route data fo...
-
ASP.NET 4 SEO Improvements (VS 2010 and .NET 4.0 Series)
Jan 1005[In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu] This is the thirteenth in a series of blog posts I’m doing on the upcoming VS 2010 and .NET 4 release. Today’s post covers some of the improvements being made around Search Engine Optimization (SEO) with ASP.NET 4. Why SEO? Search engine optimization (SEO) is important for any publically facing web-site. A large percentage of traffic to sites now comes from search...

