1

私は@Request.Browser.IsMobileDevice、ASP .NET MVC Web サイトへの訪問者を区別するために依存しています。

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 をアンインストールすると、動作が再開されます。ただしIsMobileDevice、現在のデバイスとの互換性を維持するには、51 度が必要です。

不足しているパラメータはありますか? 51度はバージョン.NET 3.1.9.3

4

2 に答える 2

1

ほんの数日前にこの同じ問題に遭遇しました。私たちは何年もの間 51Degrees ソリューションを使用してきましたが、モバイル デバイスで 414 問題が発生したばかりです。

私は「.NET用の公式WURFL API 」を使用することになりました。実装が簡単で、WURFL データ リポジトリから読み取る必要があるすべての機能を提供します。そして、414 エラーが発生しなくなりました。

于 2015-06-11T12:38:56.400 に答える