Googleクラウドプリントで試しています。クラウド印刷の /search API は、printerid と xsrf トークンを取得するために使用されます。データを投稿して応答を取得しようとしていますが、投稿するたびにリモートサーバーがエラーを返しました: (403) 禁止されています..クロスドメインの問題またはどのような問題ですか?
string str= TextBox1.Text;
var request = (HttpWebRequest)WebRequest.Create("https://www.google.com/cloudprint/search?output=json&clientid=" + str);
request.Method = "POST";
SetupWebRequest (request);
string postData = "This is a test that posts this string to a Web server.";
byte[] byteArray = Encoding.UTF8.GetBytes (postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
WebResponse response = request.GetResponse ();