I have a silverlight application which calls a web page, on clikc of a button. I want to send some parameters to the page on click of the button.
Now I can send it via query string but I don't want to do it as I might want to send a list of users which can go lenghty.
Also using sessions is not an option as these are two different applications. Also on click of the button we have to do some operations and display the results in the web page.
Is there a way I can call the web method 开发者_如何转开发in the page - Do my operation and then then show the details of the operation on my web page.
Maybe you could use something like the WebRequest class to create a POST request and then use the HttpWebResponse to get the details.
var request = (HttpWebRequest) WebRequest.Create(Uri);
request.Method = "POST";
var postData = string.Format("param1={0}¶m2={1}", "value1", "value2");
var data = Encoding.UTF8.GetBytes(postData);
request.ContentLength = data.Length;
var requestStream = request.GetRequestStream();
requestStream.Write(data, 0, data.Length);
requestStream.Close();
var response = request.GetResponse() as HttpWebResponse;
精彩评论