locked
redirect from xaml to aspx with post RRS feed

  • Question

  •  

     Hi guy,

    i would call an external webpage aspx from my silverlight project. I know that i can do that in this way:

     

    HtmlPage.Window.Navigate(new Uri("http://silverlight.net/Default?param=pippo"));

     

    But i don't want insert parameter in get request. Can i use Post method? How?

     

    Thanks,

    Monday, May 25, 2009 4:08 PM

Answers

  • Unfortunately I think that is going to be hard. HtmlPage.Window.Navigate will redirect you to the new page, but any way that you try doing a post it will be through a webclient or something similar, which will not cause a redirect. The way to solve it is probably to use the JS bridge. Create a small hidden form on the page with hidden fields for the information you want to post. Set the target of the form to the new page. Then populate the fields and post it using javascript calls from Silverlight.

    That's the way I would do it. I'm pretty sure it is going to be slightly complicated to get it to work without JS...

    Tuesday, May 26, 2009 5:00 AM

All replies

  • Unfortunately I think that is going to be hard. HtmlPage.Window.Navigate will redirect you to the new page, but any way that you try doing a post it will be through a webclient or something similar, which will not cause a redirect. The way to solve it is probably to use the JS bridge. Create a small hidden form on the page with hidden fields for the information you want to post. Set the target of the form to the new page. Then populate the fields and post it using javascript calls from Silverlight.

    That's the way I would do it. I'm pretty sure it is going to be slightly complicated to get it to work without JS...

    Tuesday, May 26, 2009 5:00 AM
  • I too initiallialy had thinked to use WebClient to realize post call to my form aspx, but the problem in fact is the impossibility to redirect the page after post call.

    The parameter to pass other page aspx aren't many, therefore i think will use get method.

     

    Sorry for my english. 

    Thanks

    Tuesday, May 26, 2009 5:17 AM