apns和asp.net

时间:2011-05-09 07:42:04

标签: asp.net apple-push-notifications

我正在构建和iPhone应用程序使用推送通知,一切正常。但现在我要用ASP.net构建服务器端。任何人都可以帮助我...因为我厌倦了使用Google获得解决方案,但不幸的是我没有找到任何东西。

...

注意:我试过这个链接http://arashnorouzi.wordpress.com/2011/03/31/sending-apple-push-notifications-in-asp-net-part-1/

但帖子尚未完成

4 个答案:

答案 0 :(得分:1)

经过几天的工作。我选择使用提供完整推送服务器的Urbanairship

Dim request As WebRequest = WebRequest.Create("https://go.urbanairship.com/api/push/broadcast/")
Dim postData As String = "{""aps"": {""badge"": ""+1"", ""alert"": ""Estez Mohamad lamaa!"",""sound"": ""default""}}"
request.Credentials = New NetworkCredential("uorecode", "uorkey")
request.Method = "POST"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
request.ContentType = "application/json"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Console.WriteLine(responseFromServer)
reader.Close()
dataStream.Close()
response.Close()

答案 1 :(得分:0)

答案 2 :(得分:0)

我使用Prowl来发送来自ASP.NET的通知:

public static void PushNotification(string header, string message)
{
    new Thread(() =>
        {
            var prowlURL = string.Format("https://api.prowlapp.com/publicapi/add?apikey={YOURKEY}&application={0}&description={1}", header, message);

            WebClient wc = null;
            try
            {
                wc = new WebClient();
                wc.UploadString(new Uri(prowlURL), "");
            }
            catch
            {
            }
            finally
            {
                if (wc != null)
                {
                    wc.Dispose();
                    wc = null;
                }
            }
        }) { Name = "PushNotification", IsBackground = true }.Start();
}

答案 3 :(得分:0)

绝对是完成的。 我用过它,效果很好。

但是我不确定它的许可是什么。