asp.net中的postMessage通过http与2个网站进行通信.. [英] postMessage in asp.net via http to communicate with 2 websites..
本文介绍了asp.net中的postMessage通过http与2个网站进行通信..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请通过http建议使用asp.net中的postMessage与2个网站进行通信..
不使用webservice或wcf。
http://softwareas.com/cross-domain-communication-with-iframes
https://www.google.co .in / #q = receiver.postMessage + in + asp.net&start = 10
please suggest via http to communicate with 2 websites using postMessage in asp.net..
without using webservice or wcf.
http://softwareas.com/cross-domain-communication-with-iframes
https://www.google.co.in/#q=receiver.postMessage+in+asp.net&start=10
推荐答案
您可以使用Web API。如果你想要一个简单的沟通,那么你可以使用以下方法 -
You can use Web API. If you want a simple communication then you can use the following method-
private static void PostData()
{
HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create("http://yourdomain.com/yourpage.aspx");
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "extension=rayhan";//post data using key-value pairs
postData += "&type=0";
byte[] data = encoding.GetBytes(postData);
httpWReq.Method = "POST";
httpWReq.ContentType = "application/x-www-form-urlencoded";
httpWReq.ContentLength = data.Length;
using (Stream stream = httpWReq.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
response.Close();
}
这篇关于asp.net中的postMessage通过http与2个网站进行通信..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文