SharePoint 2013 - HttpHandler

19.02.2014

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" %>

© 2020 Olda Zátopek
Vytvořeno službou Webnode
Vytvořte si webové stránky zdarma! Tento web je vytvořený pomocí Webnode. Vytvořte si vlastní stránky zdarma ještě dnes! Vytvořit stránky