FFagbohunka
asked on
Access Httpcontext 's Application Object in a class or control
Hi Guys,
I am writing a class that will be used to render Html on the web . I need to use the HTTPContext within the class but I get a compiler error when I try it gets to the Context.Application("Conne ctionStrin g"). Basically I am not able to retrieve my application object variables from this class. Here is the code, Please help anyone
I have the following in the web reference
System.Web
System.XML
System.Design
System.Drawing Design
System
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.WebControls;
using System.Web.UI.HtmlControls ;
using System.Drawing;
using System.Drawing.Design;
namespace PBControls
{
/// <summary>
/// Summary description for Class1.
/// </summary>
/// import System.*;
using PBSQLData;
using PBSettings;
public class myclass: IHttpHandler
{
public myclass() {}
public void ProcessRequest(HttpContext context)
{
context.Response.Write("<H 1>This is an HttpHandler Test.</H1>");
context.Response.Write("<p >Your Browser:</p>");
context.Response.Write("Ty pe: " + context.Request.Browser.Ty pe + "<br>");
//Get An Error Here
context.Response.Write( context.Application("Conne ctionStrin g"));
}
// Override the IsReusable property.
public bool IsReusable
{
get { return true; }
}
}
I am writing a class that will be used to render Html on the web . I need to use the HTTPContext within the class but I get a compiler error when I try it gets to the Context.Application("Conne
I have the following in the web reference
System.Web
System.XML
System.Design
System.Drawing Design
System
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.WebControls;
using System.Web.UI.HtmlControls
using System.Drawing;
using System.Drawing.Design;
namespace PBControls
{
/// <summary>
/// Summary description for Class1.
/// </summary>
/// import System.*;
using PBSQLData;
using PBSettings;
public class myclass: IHttpHandler
{
public myclass() {}
public void ProcessRequest(HttpContext
{
context.Response.Write("<H
context.Response.Write("<p
context.Response.Write("Ty
//Get An Error Here
context.Response.Write( context.Application("Conne
}
// Override the IsReusable property.
public bool IsReusable
{
get { return true; }
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
context.Response.Write( context.Application["Conne