.net cf 中的 httpwebrequest 未预身份验证

发布于 2024-09-30 12:08:47 字数 280 浏览 0 评论 0原文

我正在 .net cf 中使用 httpwebrequest 类以及摘要身份验证的凭据。我已将 Preauthenticate 属性设置为 true。我知道第一个请求将不包含任何身份验证,后续请求将包含任何身份验证,但这在 .net cf 中不会发生。

然而,在功能齐全的 .NET 框架中,这种情况发生得很好。

为什么这个 api 不一样?

如果无法正确进行身份验证,我可以通过解析和创建自己的方式强制进行身份验证吗?如果是,我该怎么做?

预先感谢您的建议!

苏布

I am using the httpwebrequest class in .net cf with credentials for digest authentication. I have set the Preauthenticate property to true. I understand that the first request will not contain any authentication and subsequent requests will but this does not happen in .net cf.

However, this happens just fine in the full featured .NET framework.

Why is this api different?

If it is not possible to authenticate properly, can I force authenticating in some way by parsing and creating my own? If yes, how can I do this?

Thanks in advance for your advice!

Subbu

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浊酒尽余欢 2024-10-07 12:08:47

我终于得到了答案,并认为如果我发布它可能对其他人有用。

.NET CF Httpwebrequest 对象的行为看似简单。

我所要做的就是确保AllowStreamBuffering 属性设置为true。这允许数据在发送到服务器之前在对象流中正确缓冲。这也适用于通过同一对象发出的后续请求。

看似简单:)

另外,除了上述问题之外,我还面临超时操作。 .NET CF 在局部变量范围方面还有另一种行为。从服务器解析响应后,始终调用 Httpresponse 对象的 Close 方法。这在 .NET 的完整版本中是不必要的。我想从 GC 在内存受限设备上的行为方式来看这是可以理解的。

I finally did get an answer and thought it might be useful for others if I post it.

The behaviour of the .NET CF Httpwebrequest object is deceptively simple.

All I had to do is to make sure the AllowStreamBuffering property is set to true. This allows the data to be buffered properly in the object stream before it is sent over to the server. This also applies to subsequent requests made through the same object.

Deceptively simple :)

Also, in addition to the above issue, I was also facing timeout operations. .NET CF has another behaviour in terms of local variable scope. Once the response has been parsed from the server, always call the Close method of the Httpresponse object. This is not necessary in the full blown version of .NET. I guess this is understandable in terms of the way the GC behaves on memory constrained device.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文