I really need your help with a handler. Is based on episerver technology.
The scenario is this:
I have this handler that is requesting an page id and a property name
i will add the raw code so it can be clear. I really need someone to show me a code example or the correct code.
I am a newbie and i would like to thank you all in advance for the answers
Here is the code:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using EPiServer;
using EPiServer.Core;
using EPiServer.Core.Html;
namespace Intranet.Handlers
{
public class EpiPropertyDataRetreiver : IHttpHandler
{
/// <summary>
/// You will need to configure this handler in the web.config file of your
/// web and register it with IIS before being able to use it. For more information
/// see the following link: http://go.microsoft.com/?linkid=8101007
/// </summary>
#region IHttpHandler Members
public bool IsReusable
{
// Return false in case your Managed Handler cannot be reused for another request.
// Usually this would be false in case you have some state information preserved per request.
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
var pageid = context.Request.QueryString["pageid"];
var propertyname = context.Request.QueryString["propertyname"];
DataFactory dataFactory = Global.EPDataFactory;
// get page from epi
// get property value that is in the page.
context.Response.Write("propertyname");
}
#endregion
}
}
when i load this page in my browser localhost/epipage.aspx which is this handler to show me on the page some text from another page which is requestin from that pageid and that propertyname.
willockss
Member
12 Points
54 Posts
Handler
Aug 27, 2012 07:55 AM|LINK
Hello everyone,
I really need your help with a handler. Is based on episerver technology.
The scenario is this:
I have this handler that is requesting an page id and a property name
i will add the raw code so it can be clear. I really need someone to show me a code example or the correct code.
I am a newbie and i would like to thank you all in advance for the answers
Here is the code:
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using EPiServer; using EPiServer.Core; using EPiServer.Core.Html; namespace Intranet.Handlers { public class EpiPropertyDataRetreiver : IHttpHandler { /// <summary> /// You will need to configure this handler in the web.config file of your /// web and register it with IIS before being able to use it. For more information /// see the following link: http://go.microsoft.com/?linkid=8101007 /// </summary> #region IHttpHandler Members public bool IsReusable { // Return false in case your Managed Handler cannot be reused for another request. // Usually this would be false in case you have some state information preserved per request. get { return true; } } public void ProcessRequest(HttpContext context) { var pageid = context.Request.QueryString["pageid"]; var propertyname = context.Request.QueryString["propertyname"]; DataFactory dataFactory = Global.EPDataFactory; // get page from epi // get property value that is in the page. context.Response.Write("propertyname"); } #endregion } }handlers csharp
BrockAllen
All-Star
27554 Points
4912 Posts
MVP
Re: Handler
Aug 27, 2012 01:10 PM|LINK
So what's problem or question? The handler looks fine (so far).
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
willockss
Member
12 Points
54 Posts
Re: Handler
Aug 27, 2012 01:40 PM|LINK
the scenario is this:
when i load this page in my browser localhost/epipage.aspx which is this handler to show me on the page some text from another page which is requestin from that pageid and that propertyname.