Silverlight 中的最大图像 Uri 长度 [英] Maximum Image Uri Length in Silverlight

查看:20
本文介绍了Silverlight 中的最大图像 Uri 长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道 Silverlight 中的最大 URL 长度是多少(版本 4,如果重要的话)?我知道它是 2048 并且对于 Firefox(我测试过的两个环境)基本上是无限的,但是图像请求长时间失败.任何人都知道这个神奇的数字(最大文件路径长度是 256 吗?)它比 IE 的 2048 短得多......

Does anyone know what the Maximum URL length is in Silverlight (version 4 if it matters)? I know it is 2048 and basically infinite for Firefox (the two environments I have tested in), but Image requests fail for long Uri's. Anyone know the magic number (is it 256 the max filepath length?) It is considerably shorter than the 2048 for IE...

推荐答案

根据 适用于 Silverlight 的 .NET 框架库 Uri 方案可以是 1024,而完整的 Uri 可以长达 65519 个字符.这对 v3 和 v4 都有效.

According to the .NET framework library for Silverlight The Uri scheme can be 1024 while a complete Uri can be up to 65519 characters long. This is valid for both v3 and v4.

希望这能给你一些指导.

Hope this gives you some guidance.

编辑

好的,经过长时间的测试,我设法找到了图片网址的限制.

Okay, well after long testing, I managed to track down the limit for an image URL.

方案指的是http部分.

整个 URI 不能长于 2047 之后它似乎不再加载图像.但是,我找不到其背后的任何官方推理.

The whole URI cannot be longer than 2047 after which it seems to not load the image anymore. However, I could not find any official reasoning behind it.

您收到 AG_E_NETWORK_ERROR 异常的事实与 URI 的长度无关.

The fact that you are getting AG_E_NETWORK_ERROR exceptions does not have anything to do with the length of the URI.

但是,您可以检查您的 URI 中是否有任何非法字符:

You can check however, if there are any illegal characters in your URI:

  • You can find the reserved characters in RFC2369 and see their web counterparts at w3schools

我还发现,如果链接放在XAML中,则必须替换'&'用它的%26"对应物签名.

I also found that if the link is placed in the XAML, you have to replace the '&' sign with its '%26' counterpart.

这篇关于Silverlight 中的最大图像 Uri 长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆