Re: How to pass Application.Item value back to class?

From: Kevin Spencer (kspencer_at_takempis.com)
Date: 11/11/04


Date: Thu, 11 Nov 2004 09:10:57 -0500

I just noticed that your message did mention that your prlbme was with
classes that are "not associated with a web page." So, I guessed correctly,
even though I missed that the first time I read your message. In fact, for
future reference, classes that have direct access to the current HttpContext
are any classes which implement IHttpHandler (such as Page) or IHttpModule.
Other classes must refer to the static "Current" member of
System.Web.HttpContext, and of course, they must be used in that context in
order to access it (such as in a web application or Web Service).

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"adolf garlic" <adolfgarlic@discussions.microsoft.com> wrote in message
news:468890A9-8155-4FDE-93B5-2D895C6EA282@microsoft.com...
> Suggestions please for strategy to share values across app.
>
> Scenario:
>
> I have an asp.net app that uses some com components along with .net
classes.
>
> Configuration settings for various things are held in an xml file to which
> the com has access. The xml file has different nodes for different
instances
> (dev,uat1,uat2 etc..) there is a flag attribute to show current instance.
>
> The asp.net app loads the xml in global.asax and extracts a bunch of data
> into Application.item variables.
>
> What I can't then do is access the Application variables from any classes
in
> the app that are not associated with a web page.
>
> Yes I can put the values into web.config but this present 2 problems
>  - you need to write a messy section handler with namevalue object to read
> any data
>  - the com can't see the file (well it can but for admin purposes you
> shouldn't need to duplicate values - more scope for going wrong)
>
> Can anyone think of a way in which I can pass Application variables back
to
> a class?
>
> Thanks


Relevant Pages

  • Re: For Ilya Tumanov
    ... i mount the App in the iPAQ and works ok... ... "David Fúnez" wrote in message ... >> VS would redeploy and overwrite modified XML file. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: WinForms and local DB
    ... XML file as physical storage and read all data in XML file into DataSet and ... have the DataSet stay in momery when the Windows app is running. ... > spoiled by SQL Server and SQL Server CE. ... > would be if I could make something like SQL Server CE local database work ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Support of a large table
    ... > display different parts within different controls of a vb app. ... > One part of the XML file identifies information about processor cylces. ... > demanding on memory. ...
    (comp.lang.basic.visual.misc)
  • Problem instantiating COleVariant in eVC++ 4.0
    ... I'm developing an app for Windows CE 4.2, ... takes as input an XML file and so I'm trying to make use of the MSXML ... typedef CComPtrIXMLDOMDocumentPtr; ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Calling unmanaged libraries
    ... I suggest to create mixed-mode C++ app ... Please refer to the following MSDN ...
    (microsoft.public.dotnet.languages.vc)