JSON Support in Azure
Posted
by kaleidoscope
on Geeks with Blogs
See other posts from Geeks with Blogs
or by kaleidoscope
Published on Mon, 22 Mar 2010 04:35:24 GMT
Indexed on
2010/03/22
5:41 UTC
Read the original article
Hit count: 303
Please find how we call JavaScript Object Notation in cloud applications.
As we all know how client script is useful in web applications in terms of performance.
Same we can use JQuery in Asp.net using Cloud computing which will asynchronously pull any messages out of the table(cloud storage) and display them in the browser by invoking a method on a controller that returns JavaScript Object Notation (JSON) in a well-known shape.
Syntax :
Suppose we want to write a JQuery function which return some notification while end user interact with our application so use following syntax :
public JsonResult GetMessages()
{
if (User.Identity.IsAuthenticated)
{
UserTextNotification[] userToasts =
toastRepository.GetNotifications(User.Identity.Name);
object[] data =
(from UserTextNotification toast in userToasts
select new { title = toast.Title ?? "Notification",
text = toast.MessageText }).ToArray();
return Json(data, JsonRequestBehavior.AllowGet);
}
else
return Json(null);
}
Above function is used to check authentication and display message if user is not exists in Table.
Plateform : ASP.NET 3.5 MVC 1 Under Visual Studio 2008 .
Please find below link for more detail :
http://msdn.microsoft.com/en-us/magazine/ee335721.aspx
© Geeks with Blogs or respective owner