Silverlight 中的最大图像 Uri 长度
有谁知道 Silverlight 中的最大 URL 长度是多少(如果重要的话,版本 4)?我知道它是 2048 并且对于 Firefox 来说基本上是无限的(我测试过的两个环境),但是对于长 Uri 来说,图像请求会失败。任何人都知道这个神奇数字(最大文件路径长度是 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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Silverlight 的 .NET 框架库
Uri
方案可以是 1024,而完整的Uri
最长可达 65519 个字符。这对于 v3 和 v4 都有效。希望这能给您一些指导。
编辑
好的,经过长时间的测试,我成功地找到了图像 URL 的限制。
该方案指的是
http
部分。整个
URI
不能超过2047,之后它似乎不再加载图像。但是,我找不到其背后的任何官方理由。您收到
AG_E_NETWORK_ERROR
异常的事实与URI
的长度没有任何关系。不过,您可以检查 URI 中是否存在非法字符:
项我还发现,如果链接放置在 XAML 中,您必须替换“&”与其对应的“%26”进行签名。
According to the .NET framework library for Silverlight The
Uri
scheme can be 1024 while a completeUri
can be up to 65519 characters long. This is valid for both v3 and v4.Hope this gives you some guidance.
EDIT
Okay, well after long testing, I managed to track down the limit for an image URL.
The scheme refers to the
http
part.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.The fact that you are getting
AG_E_NETWORK_ERROR
exceptions does not have anything to do with the length of theURI
.You can check however, if there are any illegal characters in your URI:
I also found that if the link is placed in the XAML, you have to replace the '&' sign with its '%26' counterpart.