ASP.Net/Network/WebHandler

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

extends IHttpHandler

   <source lang="csharp">

<%@ WebHandler Language="C#" Class="XamlGen" %> using System; using System.Web; public class XamlGen : IHttpHandler {

   public void ProcessRequest (HttpContext context) 
   {
       context.Response.ContentType = "text/xaml";
       context.Response.Write("<Canvas xmlns="http://schemas.microsoft.ru/client/2007" " +
           "xmlns:x="http://schemas.microsoft.ru/winfx/2006/xaml">" +
           "<TextBlock Foreground="lime"><Run>XAML content</Run><LineBreak/>" + 
           "<Run>[generated at " + DateTime.Now + "]</Run>" +
           "</TextBlock></Canvas>");
   }

   public bool IsReusable 
   {
       get {return true;}
   }

}

</source>