?
Solved

Access Httpcontext 's Application Object in a class or control

Posted on 2006-10-23
4
Medium Priority
?
266 Views
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.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("<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; }
            }
}
0
Comment
Question by:FFagbohunka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:ostdp
ID: 17791162
Try

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

Accepted Solution

by:
Paul_Tew earned 2000 total points
ID: 17819563
I think you want

HttpContext.Current.Application["ConnectionString"]
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

801 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