我依靠@Request.Browser.IsMobileDevice来区分一个ASP .NET网站的访问者。
我正在使用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时,它会恢复工作。然而,我需要51度来保持IsMobileDevice与当前设备的兼容性。
我遗漏了什么参数吗?51度是.NET 3.1.9.3版本
发布于 2015-06-11 20:38:56
就在几天前,我遇到了同样的问题。我们已经使用51Degrees解决方案很多年了,但现在才在移动设备上遇到414问题。
我最后用的是"The official WURFL API for .NET“。易于实现,并提供了从WURFL数据存储库读取所需的所有功能。现在我不再得到414错误。
发布于 2016-02-05 16:12:22
如果你发现自己处于类似的情况,你可以:
只是解决414问题的另一种方法。
https://stackoverflow.com/questions/28476519
复制相似问题