【发布时间】:2015-02-12 11:39:32
【问题描述】:
我依靠@Request.Browser.IsMobileDevice 来区分访问 ASP .NET MVC 网站的访问者。
我正在使用51 Degrees 库。但是,当从移动设备浏览某些图像时,出现错误 414 (request-uri too long)。在 PC 上,这不会发生,仅在移动设备上发生。
堆栈显示PathTooLongException 在:
à System.IO.PathHelper.GetFullPathName()
à System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
à System.IO.Path.GetFullPathInternal(String path)
à System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
à System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
à System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
à System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
à System.Web.InternalSecurityPermissions.PathDiscovery(String path)
à System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping)
à System.Web.HttpServerUtility.MapPath(String path)
à FiftyOne.Foundation.Mobile.Detection.Feature.ImageOptimiser.OptimisedImageResponse(HttpContext context)
à FiftyOne.Foundation.Mobile.Detection.DetectorModule.OnPostAuthorizeRequest(Object sender, EventArgs e)
à System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
à System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
似乎FiftyOne 在此堆栈中。当我卸载 51Degrees 时,它会恢复工作。但是我需要 51Degrees 来保持IsMobileDevice 与当前设备兼容。
我缺少任何参数吗? 51度是版本.NET 3.1.9.3
【问题讨论】:
-
似乎
ImageOptimiser.OptimisedImageResponse正在尝试将虚拟路径映射到物理磁盘路径。完整文件路径的最大长度仅为 260 个字符。我的猜测是该库已经设法创建了一条系统无法处理的路径。 -
我刚刚遇到了这个问题。你搞定了吗?
标签: asp.net-mvc mobile 51degrees