Access Httpcontext 's Application Object in a class or control

Posted on 2006-10-23
Last Modified: 2010-04-16
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("ConnectionString"). 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.Drawing Design

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("<H1>This is an HttpHandler Test.</H1>");      
                  context.Response.Write("<p>Your Browser:</p>");
                  context.Response.Write("Type: " + context.Request.Browser.Type + "<br>");
                                                //Get An Error Here
                  context.Response.Write( context.Application("ConnectionString"));

            // Override the IsReusable property.
            public bool IsReusable
                  get { return true; }
Question by:FFagbohunka

Expert Comment

ID: 17791162

context.Response.Write( context.Application["ConnectionString"]);

Accepted Solution

Paul_Tew earned 500 total points
ID: 17819563
I think you want


Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help on C# Linq query on object 6 62
Graphics 2 27
SqlDependency to get update from sql to my c# app 2 37
Printing 1 50
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now