开发者

Silverlight Calling an HttpHandler

开发者 https://www.devze.com 2022-12-30 00:53 出处:网络
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 brow

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 wi开发者_如何学JAVAll 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?


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:

  • Hitting F5 in a Silverlight project that is not in a web project... so the URL in the address bar will start with file:/// instead of http://. You can't request cross-scheme.
  • Hitting a different domain. Sub-domains that are different are cross-domain as well. You'll a need cross domain permissions file to enable this.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号