How to fix 'Illegal characters in path' on a basic MVC3 route?

600 Views Asked by At

Given the following two routes:

        routes.MapRoute(name: "NationalRssResults", url: "{searchTerm}/rss", defaults: new { controller = "Results", action = "SearchWholeCountryRss" });
        routes.MapRoute(name: "CityRssResults", url: "{city}-{state}/{searchTerm}/rss", defaults: new { controller = "Results", action = "SearchCityStateRss" });

Navigating to localhost:51860/fire-blanket/rss returns data just fine, however trying localhost:51860/SomeState-SomeCity/fire-blanket/rss returns in an Illegal characters in path error.

These routes are at the top of my list so no others should interfere, right?

I have traced this all the way through the RSS content generation and always begins with:

<?xml version="1.0" encoding="utf-16"?><rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0"><channel><title>...

The view looks like this:

@model MyApp.Models4.ResultsPage

@Html.Raw(Model.rssResults)

I have already tried a few of the web.config suggestions here - still no go.

I'm not sure why I'm getting this error. Assistance appreciated.

Thanks.

0

There are 0 best solutions below