Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Framework.Utilities.RDFTriple request = base.RDFTriple;

            //The system default is True and True for showdetails and expand, but if its an external page call to this page,
            //then its set to false for expand.
            if (HttpContext.Current.Request.Headers["Expand"] != null)
            {
                request.Expand = Convert.ToBoolean(HttpContext.Current.Request.Headers["Expand"].ToString());
            }
            else if (HttpContext.Current.Request["Expand"] != null)
            {
                request.Expand = Convert.ToBoolean(HttpContext.Current.Request["Expand"].ToString());
            }
            else
            {
                request.Expand = false;
            }


            if (HttpContext.Current.Request.Headers["ShowDetails"] != null)
            {
                request.ShowDetails = Convert.ToBoolean(HttpContext.Current.Request.Headers["ShowDetails"].ToString());
            }
            else if (HttpContext.Current.Request["ShowDetails"] != null)
            {
                request.ShowDetails = Convert.ToBoolean(HttpContext.Current.Request["ShowDetails"].ToString());
            }
            else
            {
                request.ShowDetails = true;
            }

            base.LoadRDFData();

            Response.Clear();
            Response.ContentType = "application/rdf+xml";
            Response.Charset     = "charset=UTF-8";
            Response.StatusCode  = Convert.ToInt16("200");

            // Tell the bots that this is slow moving data, add an exires at some random date up to 30 days out
            DateTime expires = DateTime.Now.Add(TimeSpan.FromDays(random.NextDouble() * 29 + 1));

            Response.AddHeader("Expires", expires.ToUniversalTime().ToString("r"));

            Response.Write(base.RDFData.InnerXml);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Framework.Utilities.RDFTriple request = base.RDFTriple;
            VCardPerson vcard = new VCardPerson();

            this.LoadPresentationXML();

            XmlNode x = this.PresentationXML.SelectSingleNode("Presentation[1]/ExpandRDFList[1]");

            if (x != null)
            {
                base.RDFTriple.ExpandRDFList = x.InnerXml;
            }

            base.LoadRDFData();


            if (base.RDFData.SelectNodes("rdf:RDF[1]/rdf:Description[1]/*[1]", base.RDFNamespaces).Count < 1)
            {
                Response.Clear();
                Server.ClearError();
                Response.Status     = "404 not found";
                Response.StatusCode = Convert.ToInt16("404");
                Server.Transfer("~/Error/404.aspx");
            }
            else
            {
                this.GetVcard(ref vcard);

                Response.Clear();
                Response.ContentType = "text/vcard";

                var cardString     = vcard.ToString();
                var inputEncoding  = Encoding.Default;
                var outputEncoding = Encoding.GetEncoding("windows-1257");
                var cardBytes      = inputEncoding.GetBytes(cardString);
                var outputBytes    = Encoding.Convert(inputEncoding, outputEncoding, cardBytes);
                Response.StatusCode = Convert.ToInt16("200");
                Response.AddHeader("Content-disposition", string.Format("attachment; filename=\"{0}\";", vcard.FirstName + "_" + vcard.LastName + ".vcf"));

                Response.OutputStream.Write(outputBytes, 0, outputBytes.Length);

                Response.End();
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Framework.Utilities.RDFTriple request = base.RDFTriple;

            //The system default is True and True for showdetails and expand, but if its an external page call to this page,
            //then its set to false for expand.
            if (HttpContext.Current.Request.Headers["Expand"] != null)
            {
                request.Expand = Convert.ToBoolean(HttpContext.Current.Request.Headers["Expand"].ToString());
            }
            else if (HttpContext.Current.Request["Expand"] != null)
            {
                request.Expand = Convert.ToBoolean(HttpContext.Current.Request["Expand"].ToString());
            }
            else
            {
                request.Expand = false;
            }


            if (HttpContext.Current.Request.Headers["ShowDetails"] != null)
            {
                request.ShowDetails = Convert.ToBoolean(HttpContext.Current.Request.Headers["ShowDetails"].ToString());
            }
            else if (HttpContext.Current.Request["ShowDetails"] != null)
            {
                request.ShowDetails = Convert.ToBoolean(HttpContext.Current.Request["ShowDetails"].ToString());
            }
            else
            {
                request.ShowDetails = true;
            }

            base.LoadRDFData();

            Response.Clear();
            Response.ContentType = "application/rdf+xml";
            Response.Charset     = "charset=UTF-8";
            Response.StatusCode  = Convert.ToInt16("200");

            Response.Write(base.RDFData.InnerXml);
        }