0
我想從Windows Phone應用程序插入數據到數據庫使用PHP腳本。 這是我單擊按鈕時執行的C#代碼。通過POST變量與Windows Phone應用程序
var request = WebRequest.Create(new Uri("xxx/Insert.php")) as HttpWebRequest;
request.Method = "POST";
string postdata = "Title=test&CategoryID=1";
byte[] data = Encoding.UTF8.GetBytes(postdata);
using (var requestStream = await Task<Stream>.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, request))
{
await requestStream.WriteAsync(data, 0, data.Length);
}
我得到的PHP腳本變量與
<?php
$title = $_POST["Title"];
$categoryID = $_POST["CategoryID"];
...
?>
有人有同樣的問題here,但解決的辦法沒有奏效,因爲 1)Web客戶端不可用於WP8 2.)第二種解決方案在全局:: System.Diagnostics.Debugger.Break()
這一行中引發App.igcs中的異常。問題根本就沒有發生。有沒有人遇到同樣的問題?