Exception Details: System.ArgumentException: Illegal characters in path.

Topics: ASP.NET 2.0
Sep 23, 2007 at 10:03 AM
I have just posted a new entry to my blog; it has "double quotes" in the title...

The article views fine on the Home page, but when I click on the comments link at the bottom of the article I get an ASP Server Error with the following stack trace:

ArgumentException: Illegal characters in path.
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +3609834
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath2.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +169
System.Web.CachedPathData.GetConfigPathData(String configPath) +382
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +132
System.Web.HttpContext.GetFilePathData() +27
System.Web.HttpContext.GetConfigurationPathData() +26
System.Web.Configuration.HttpCapabilitiesBase.GetBrowserCapabilities(HttpRequest request) +133
System.Web.HttpRequest.get_Browser() +197
System.Web.ErrorFormatter.RequiresAdaptiveErrorReporting(HttpContext context) +104

All other articles are working fine, so I assume that it is the double quotes that are causing the exception; they are being passed to the URL as %22, and perhaps not translated back when trying to read form the XML file etc?? Just a guess.

Thanks for any assistance; my quick fix was to replace the double quotes with single quotes, which seems to work fine; but a proper fix at some point would be appreciated...

Many thanks,

Sep 23, 2007 at 10:35 AM
Sorry for that. It has been fixed since the release of version 1.1. You can get the latest source code or wait a week for the 1.2 release. A quick fix is to add this line to the RemoveIlegalCharacters() method in BlogEngine.Core.Utils.cs

text = text.Replace("\"", string.Empty);