SharePoint 2013 - HttpHandler
Zde je postup, jak vytvořit HttpHandler pro SharePoint 2010/2013.
Založit soubor AjaxHandler.cs
using System;
using System.Web;
using Microsoft.SharePoint;
namespace MyNamespace
{
public class AjaxHandler : IHttpHandler
{
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.CacheControl = "no-cache";
context.Response.AddHeader("Pragma", "no-cache");
context.Response.Expires = -1;
context.Response.Write("Vysledek");
}
}
}
Založit soubor AjaxHandler.ashx do adresáře Assembly/Layouts/MojeReseni/
<%@ Assembly
Name="Microsoft.SharePoint,
Version=15.0.0.0,
Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly
Name="MyDLL,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=a8b85743f45aceb0" %>
<%@ WebHandler
Language="C#"
Class = "MyNamespace.AjaxHandler" %>
Odkazy
- Deploying an ASP.NET HttpHandler to SharePoint 2010
https://blogs.msdn.microsoft.com/kaevans/2010/08/04/deploying-an-asp-net-httphandler-to-sharepoint-2010/
