Silverlight 4.0 Beta : HttpWebRequest.GetResponse()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FreddyMack
    New Member
    • Jan 2010
    • 2

    Silverlight 4.0 Beta : HttpWebRequest.GetResponse()

    Two questions:

    1) In Silverlight 4.0 Beta, I cannot find HttpWebRequest. GetResponse() ... any ideas where the functionality may be? I have found the Async form, but not the Sync form.

    2) Within that same environment, I'd like to configure calling to a different server through the call, HttpWebRequest. BeginGetRespons e( "http://localhost:8080/J2EE/index.jsp" ) ... the security will not permit this because it is a call to a different server. Where do I configure allowing this?

    All the Best,

    FreddyMack


    Microsoft Visual Studio 2010
    Version 10.0.21006.1 B2Rel
    Microsoft .NET Framework
    Version 4.0.21006 B2Rel

    Installed Version: Professional
    Microsoft Visual C# 2010
    Microsoft Visual Web Developer 2010
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Silverlight is developed as an asynchronous enviroment. Therefore you cannot use synchronous methods in this environment. You have to work with the Asynchronous version of the HttpWebRequest. BeginResponse

    In order to prevent the application from potential security problems, Silverlight
    does not allow you to access information for URLs that are cross-zone, cross-domain, and cross-scheme (see the MSDN article on URL Access Restrictions in Silverlight).

    -Frinny

    Comment

    • FreddyMack
      New Member
      • Jan 2010
      • 2

      #3
      Hi Frinny. I accept the async-only answer. I'm new to Silverlight, and I swear I've seen, copied and pasted sync-examples for previous versions of Silverlight.

      However, I see this note in the page you referred me to:

      "You can access resources with a cross-scheme URL (allowed between HTTP and HTTPS) on Silverlight, but you need to explicitly enable this with a security policy file. See Network Security Access Restrictions in Silverlight topic for more information."

      I was looking for information about how to note that security policy.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        I only have limited experience using Silverlight.

        Silverlight has been developed on an asynchronous platform...it may be possible to call synchronous methods but these methods would be difficult to call and would likely cause more problems. If there is an asynchronous version of the thing that you want to use I'd use it since it'll just make your life easier.

        As for the cross domain thing. I'm glad that you can do it! When I was looking into Silverlight this wasn't possible (I should have read the article instead of glancing through it!)


        This article looks like a winner regarding the security policy: Network Security Access Restrictions in Silverlight (edit: ahh, it's the one in the Note that you were referring to)

        -Frinny
        Last edited by Frinavale; Jan 18 '10, 06:43 PM. Reason: Checked previous article

        Comment

        Working...