Saturday, January 5, 2013

Post to and display web page from Silverlight

Post to and display web page from Silverlight

I want to post to a web page from my Silverlight application and have the web page appear in a new window.

I can show a web page in a new window using the GET method, using the following code:

var options = new HtmlPopupWindowOptions(); HtmlPage.PopupWindow(new Uri("http://localhost:12345/test.aspx"), "_blank", options); 

I can post to a web page and get the resulting data back using this code:

var request = (HttpWebRequest)WebRequest.Create(new Uri("http://localhost:12345/test.aspx")); request.Method = "POST"; request.ContentType = "text/xml"; request.BeginGetRequestStream(requestResult => {     using (var stream = request.EndGetRequestStream(requestResult))     {         using (var writer = new StreamWriter(stream))         {             writer.Write("hello");         }     }      request.BeginGetResponse(responseResult =>     {         var response = request.EndGetResponse(responseResult);         using (var stream = response.GetResponseStream())         {             using (var reader = new StreamReader(stream))             {                 var str = reader.ReadToEnd();             }         }     }, null); }, null); 

But what I can't do is the two together - post to the page but instead of getting the data back have the resulting page shown in a browser window. I don't know if this is possible, but any help to achieve this would be much appreciated.

Answers & Comments...




2 comments:

Anonymous said...

Then along came the spider receiving targeted and more as clear as mud,
because spammers found new ways in which to obtain past the ranking system as well as in no time get their sites on the top.
Here are several suggestions that will aid entrepreneurs in saving plenty of time:.

While search results optimization techniques to achieve a desirable
internet search engine rank may be implemented after having a website was made, developed and
launched, there is certainly less backtracking to be done if internet search engine
rank tactics are accomplished or at least considered during
web site design and development.
Here is my webpage :: instant article wizard review

Anonymous said...

Ahаa, itѕ fastiԁious conveгsation аbout
this aгticle here at this website, Ι haѵe
reaԁ аll that, ѕo at this timе me also commenting heгe.
My blog ; photos from Chios

Post a Comment

Send us your comment related to the topic mentioned on the blog