开发者

.Net problem "Illegal characters in path."

Hi all ok I'm not a .net developer I'm from a PHP, python background and I'm not sure what to do with this.

I have the following error when trying to load one of our sites. Please can someone help

[ArgumentException: Illegal characters in path.] System.IO.Path.CheckInvalidPathChars(String path) +7491109 System.IO.Path.GetFileName(String path) +19 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +16 System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +77 System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +54 System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) +74 System.Threading.CompressedStack.runTryCode(Object userData) +70 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) +0 System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state) +108 System.Xml.XmlTextReaderImpl.OpenUrl() +186 System.Xml.XmlTextReaderImpl.Read() +208 System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space) +217 System.Xml.XPath.XPathDocument..ctor(String uri, XmlSpace space) +116 System.Xml.XPath.XPathDocument..ctor(String uri) +6 OpenBay.Utils.XPathUtils.GetNodes(String xpathQuery, String xmlFile) +30 OpenBay.Wms.Controllers.SiteController.SetErrorPages(Site site) +21 OpenBay.Wms.Controllers.SiteController.GetSite(Uri uri, DirectoryInfo dir, String applicationName) +104 OpenBay.Wms.HttpModule.UrlProcessHttpModule.GetSiteParameters(HttpApplication app, RequestInfo info) +172 OpenBay.Wms开发者_如何学运维.HttpModule.UrlProcessHttpModule.ProcessRequest(Object o, EventArgs args) +338 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

thanks guys


Your code will call System.IO.Path.CheckInvalidPathChars, which in turn checks for the the following:

  1. double quote (")

  2. left angle bracket (<)

  3. right angle bracket (>)

  4. veritical bar (|)

and for control characters less than 32 decimal (space).

So Make sure your path doesn't contain them.

Edit: comment from Guy Lowe

my issue was my unescaped \ in c:\ making it c:\ fixed it


Nice Stacktrace, but the invalid path would be more helpful.

In my oponion, the path provided to OpenBay.Utils.XPathUtils.GetNodes(string, string) has some invalid arguments. Use System.IO.Path.CheckInvalidPathChars() to check which characters are invalid and maybe contained in the argument provided to the method above.


Please look at this link, I am using VS 2019: VS Test cases issue, NUnit

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜