开发者

Calling a aspx page from a silverlight application.

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}&param2={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;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜