휴대 기기 사용자가 일반 데스크톱에서 사이트를 볼 때 발생하지 않는 MVC 오류가 발생하는 문제가 있습니다. Chrome의 개발자 도구를 사용하고 기본값 이외의 다른 UA를 적용하여 일관되게 오류를 재현 할 수 있습니다.사용자 에이전트가 MVC DisplayFor를 발생시킵니다. ArgumentException : 경로에 잘못된 문자가 있습니다.
던져 기본이되는 예외입니다 : 피들러를 사용 ArgumentException: Illegal characters in path. at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) at System.IO.Path.GetExtension(String path) at System.Web.WebPages.DefaultDisplayMode.TransformPath(String virtualPath, String suffix) at System.Web.WebPages.DefaultDisplayMode.GetDisplayInfo(HttpContextBase httpContext, String virtualPath, Func'2 virtualPathExists) at System.Web.WebPages.DisplayModeProvider.GetDisplayInfoForVirtualPath(String virtualPath, HttpContextBase httpContext, Func'2 virtualPathExists, IDisplayMode currentDisplayMode, Boolean requireConsistentDisplayMode) at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext, List'1 locations, String name, String controllerName, String areaName, String cacheKey, String[]& searchedLocations) at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations) at System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache) at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClass2.<FindPartialView>b__1(IViewEngine e) at System.Web.Mvc.ViewEngineCollection.Find(Func'2 lookup, Boolean trackSearchedPaths) at System.Web.Mvc.ViewEngineCollection.FindPartialView(ControllerContext controllerContext, String partialViewName) at System.Web.Mvc.Html.TemplateHelpers.ExecuteTemplate(HtmlHelper html, ViewDataDictionary viewData, String templateName, DataBoundControlMode mode, GetViewNamesDelegate getViewNames, GetDefaultActionsDelegate getDefaultActions) at System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(HtmlHelper html, ModelMetadata metadata, String htmlFieldName, String templateName, DataBoundControlMode mode, Object additionalViewData, ExecuteTemplateDelegate executeTemplate) at System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(HtmlHelper html, ModelMetadata metadata, String htmlFieldName, String templateName, DataBoundControlMode mode, Object additionalViewData) at System.Web.Mvc.Html.TemplateHelpers.TemplateFor[TContainer,TValue](HtmlHelper'1 html, Expression'1 expression, String templateName, String htmlFieldName, DataBoundControlMode mode, Object additionalViewData, TemplateHelperDelegate templateHelper) at System.Web.Mvc.Html.TemplateHelpers.TemplateFor[TContainer,TValue](HtmlHelper'1 html, Expression'1 expression, String templateName, String htmlFieldName, DataBoundControlMode mode, Object additionalViewData) at System.Web.Mvc.Html.DisplayExtensions.DisplayFor[TModel,TValue](HtmlHelper'1 html, Expression'1 expression)
, 실패한 요청에 대한 성공적인 비교 요청의 유일한 차이점은 사용자 에이전트 (과의 일환으로 jQuery를에 의해 추가 된 캐시 버스터입니다 쿼리 문자열 매개 변수).
이 예외의 원인이되는 UA 만 변경하는 이유는 무엇이며 발생 가능한 모든 장소에 대해 특정 작업을 시스템에 작성하지 않고이 문제를 방지하려면 어떻게해야합니까?
해결 방법을 찾으셨습니까? –
@RomanMik - 실제로 내 뷰 모델에서 수율 블록을 사용하지 않는 CSJ와 동일한 해결 방법을 발견했습니다. yield를 사용하는 대신 목록을 구체화하도록 코드를 변경 한 후 문제가 해결되었습니다. 여전히 .NET에서 특정 사용자 에이전트를 사용하는 이유를 완전히 이해하지 못하고 있지만 최소한이를 해결할 수있는 표준 방법이 있습니다. – SignalRichard
관련 SO 기사에서 공유 한 ASP.NET DisplayModeProvider와 관련된 다른 해결책을 찾았습니다. http://stackoverflow.com/questions/33694842/illegal-characters-in-path-depending-on-user-agent/40229384#40229384 –