1

我依靠@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

4

2 回答 2

1

几天前我遇到了同样的问题。多年来,我们一直在使用 51Degrees 解决方案,但现在在移动设备上遇到了 414 问题。

我最终使用了“ The official WURFL API for .NET ”。易于实施并提供我们需要从 WURFL 数据存储库中读取的所有功能。现在我不再收到 414 错误。

于 2015-06-11T12:38:56.400 回答
0

如果您发现自己处于类似情况,您可以:

  1. 转到51Degrees.config文件
  2. 打开它
  3. 向下滚动,直到找到imageOptimisation部分
  4. 设置启用
  5. 保存并重新启动应用程序

只是解决 414 问题的另一种方法。

于 2016-02-05T08:12:22.253 回答