Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

You can use Web API. If you want a simple communication then you can use the following method-

C#
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();
        }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900