Showing posts with label handler. Show all posts
Showing posts with label handler. Show all posts

Friday, August 21, 2015

IIS - Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list - ASP.net

This error is due to asp.net installation on IIS. To resolve this error you need to install asp.net on IIS. For this you need to execute aspnet_regiis.exe -i command. First location this exe. It should be on following location:
On Windows 32 bit:
C:\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i
On Windows 64 bit:
C:\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i


Thursday, August 13, 2015

asp.net-use Session in .ashx handler

Following is the technique to use Session in .ashx handler:

public class DownloadHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
    public void ProcessRequest(HttpContext context)
    {
      string Name = "";
      if (context.Session["UserName"] != null)
         Name = context.Session["UserName"].ToString();
    }
}


Interface used:  IRequiresSessionState this interface is in System.Web.SessionState and Session will be available in context.Session["UserName"]