namespace XXXX.TourAdmin.Web.Admin
{
///
/// Summary description for $codebehindclassname$
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class VideoHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
//context.Response.ContentType = "text/plain";
context.Response.ContentType = "UTF-8";
context.Response.Write(this.GetVideoXml());
}
protected string GetVideoXml()
{
VideoContext vc = new VideoContext();
var videos = from v in vc.Videos
select new
{
VideoClip = v.FileLocation,
Title = v.Title,
Date = v.VideoDate,
};
XDocument xmlDoc = new XDocument();
XElement xEleVideos = new XElement("videos");
xmlDoc.Add(xEleVideos);
foreach (var v in videos)
{
xEleVideos.Add(new XElement("video", new XAttribute("VideoClip", v.VideoClip),
new XAttribute("Title", v.Title), new XAttribute("Copy", v.Date)));
}
string s = xmlDoc.ToString();
return s;
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
Title | FileLocation | VideoDate | active |
Miami, Florida | 20080914 | 2009-02-12 00:00:00 | 1 |
now put the url in the address bar
http://localhost/XXXX.TourAdmin.Web/Admin/VideoHandler.ashx
<videos>
<video VideoClip="20080914" Title="Miami, Florida" copy="2009-02-12T00:00:00" />
<videos>
No comments:
Post a Comment