2011-05-09 17 views
1

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

....

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

,但尚未

+0

您已经看过[part 2](http://arashnorouzi.wordpress.com/2011/04/01/sending-apple-push-notifications-in-as-p-net-%e2%80%93-part -2-generating-apns-certificates /)和[part 3](http://arashnorouzi.wordpress.com/2011/04/13/sending-apple-push-notifications-in-asp-net-%e2%80 %93-part-3-apns-certificates-registration-on-windows /)?第4部分将讨论[apns-sharp library](http://code.google.com/p/apns-sharp/) - 你在使用它吗?如果你是这样,你可能想标记你的问题[apns-sharp](http://stackoverflow.com/questions/tagged/apns-sharp)。你尝试过那里的样品吗? – Rup 2011-05-09 08:44:49

+0

不,我不想使用apns-sharp,但不幸的是这是我发现使用.net的唯一库。我已阅读第一部分和第二部分和第三部分(所有这部分不包含任何.net开发示例),你有什么想法,......关于 – 2011-05-09 09:30:39

+0

行;我鼓励你重新考虑使用apns-sharp,因为它可以自由使用(Apache 2许可证),并且它已经被开发和测试。如果不是的话,你可能会从阅读我认为的来源中学习。你为什么不想用它?不,我没有任何经验,我自己很抱歉。 – Rup 2011-05-09 10:16:14

回答

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() 
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(); 
} 
0

它肯定是结束了。 我用过它,它效果很好。

但是我不确定它的授权是什么。