Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Web;
- using Microsoft.SharePoint;
- using Microsoft.SharePoint.Publishing;
- using System.Web.Caching;
- namespace MyTestSharePoint.WebHandlers
- {
- public class TestMyTestArticleHandler : IHttpHandler
- {
- bool HasErrors = false;
- Cache Cache;
- HttpRequest Request;
- HttpResponse Response;
- SPSite CurrentSite;
- SPWeb CurrentWeb;
- public bool IsReusable
- {
- get { return false; }
- }
- public void ProcessRequest(HttpContext context)
- {
- this.Cache = context.Cache;
- this.Request = context.Request;
- this.Response = context.Response;
- Response.Cache.SetCacheability(HttpCacheability.NoCache);
- Response.Cache.SetNoStore();
- Response.Cache.SetExpires(DateTime.MinValue);
- try
- {
- this.CurrentSite = SPContext.Current.Site;
- this.CurrentWeb = SPContext.Current.Web;
- string pagePath = Request.UrlReferrer.AbsolutePath;
- string pageName = pagePath.Substring(pagePath.LastIndexOf('/') + 1);
- Response.Write("pageName: " + pageName);
- }
- catch (Exception ex)
- {
- Response.Write("Exception: " + ex.ToString());
- if (ex.InnerException != null)
- Response.Write("InnerException: " + ex.InnerException.ToString());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement