Silverlight 调用 HttpHandler
我有一个 Silverlight 2 应用程序,我试图使用 WebClient 来调用 HttpHandler。我有 HttpHandler 只是发送一封电子邮件,上面写着调用时进行测试。如果我通过浏览器点击它,我就会收到电子邮件。但是,使用带有委托的 WebClient 对象,我似乎无法连接它。
我开始考虑使用跨域策略进行连接。但是,HttpHandler 位于 SSL Web 应用程序内。部署该控件后,它将位于同一个 SSL Web 应用程序中(通过使用 asp.net silverlight 控件)。
这行得通吗?如果没有,我该怎么做才能让它发挥作用?
I have a Silverlight 2 application that I'm trying to get to invoke an HttpHandler by using WebClient. I have the HttpHandler just sending an email that says test when invoked. If I hit it via a browser, I get the email. However, using a WebClient object with a delegate, I can't seem to get it to connect.
I've started to think about using a Cross Domain Policy for connecting. However, the HttpHandler is within an SSL web app. When the control is deployed, it will be within the same SSL web app (by using the asp.net silverlight control).
Will this work? If not, what can I do to make it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试确定是否是您的 Web 服务的问题,请尝试仅单击常规 .txt 或将与您的 .Xap 一起提供的任何类型的文件,以查看是否是您的 WebClient 代码的问题。
您很可能正在做一些不起作用的事情,例如:
file:/// 开头
而不是http://
。您不能请求跨方案。我不建议尝试使用 Windows 窗体进行验证,因为它完全可以请求任何网页,而无需实施这些安全限制。
If you are trying to determine whether it is an issue with your web service, please try hitting just a regular .txt or any kind of file that will be served alongside your .Xap, to see if it's an issue with your WebClient code.
More than likely you are doing something that won't work, such as:
file:///
instead ofhttp://
. You can't request cross-scheme.I wouldn't recommend trying to validate with Windows Forms, since it is able to request any web page at all, without these security restrictions in place.