<%@ WebHandler Language="C#" Class="Adicionar" %> using System; using System.Web; using System.Web.SessionState; public class Adicionar : IHttpHandler, IReadOnlySessionState { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; /* ================================================================================= */ /* ================================================================================= */ if (context.Request.ServerVariables["HTTP_REFERER"] == null || context.Request.ServerVariables["HTTP_REFERER"].ToUpper().IndexOf("/SITE/CATALOGO/ARTIGOS") < 0) { // REDIRECCIONA PARA A PÁGINA DE LOGIN.aspx // CASO ESTA PÁGINA SEJA ACEDIDA DIRECTAMENTE SEM PASSAR PELO SITE context.Response.Redirect("/login.aspx"); } /* ================================================================================= */ /* UTILIZADOR AUTENTICADO */ try { Intranet.Users intranetUser = (Intranet.Users)context.Session["intranetUser"]; /* ============================================================================= */ int Artigo = Convert.ToInt16(context.Request.QueryString["a"].ToString()); int Familia = Convert.ToInt16(context.Request.QueryString["f"].ToString()); string _familia = SiteECom.Catalogo.Artigos.Familias.Adicionar(Artigo, Familia, intranetUser.ID, intranetUser.Departamento.ID); context.Response.Write(_familia); } catch (Exception) { context.Response.Write("erro"); } } public bool IsReusable { get { return false; } } }