Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Global.asax in asp.net 2.0

Reply
Thread Tools

Global.asax in asp.net 2.0

 
 
Arjen
Guest
Posts: n/a
 
      08-01-2005
Hi,

How can I make some variables global (public available) with the global.asax
file inside asp.net 2.0?

- I want to access these variables from code-behind files (and maybe from
aspx files).
- The global.asax haves no code-behind file.
- I want to set the values of the public variables inside the
Application_BeginRequest method.

Thanks!


 
Reply With Quote
 
 
 
 
Tom.PesterDELETETHISSS@pandora.be
Guest
Posts: n/a
 
      08-01-2005

I think that you want a variable that is global within the scope of a page.
If that's what you want use
HttpContext.Current.Items in your external class files
or
Context.Items in your aspx & global.asax file

An overview of global data in asp.net can be found here :
http://msdn.microsoft.com/msdnmag/is...PNETUserState/

I hope it helps...
Let me know if you have any more questions..

Cheers,
Tom Pester

> Hi,
>
> How can I make some variables global (public available) with the
> global.asax file inside asp.net 2.0?
>
> - I want to access these variables from code-behind files (and maybe
> from
> aspx files).
> - The global.asax haves no code-behind file.
> - I want to set the values of the public variables inside the
> Application_BeginRequest method.
> Thanks!
>



 
Reply With Quote
 
 
 
 
Peter Kellner
Guest
Posts: n/a
 
      08-02-2005
On Mon, 1 Aug 2005 23:30:23 +0200, "Arjen" <(E-Mail Removed)>
wrote:

>Hi,
>
>How can I make some variables global (public available) with the global.asax
>file inside asp.net 2.0?
>


use the static Application class. Here is an example of what might go
in the global.asax file:

Application["Q"] = new BlackHen.Threading.WorkQueue(rrQ);

And, in your codebehind to reference the class:

WorkQueue wq = ((WorkQueue)Application["Q"]);


This is as close to making a global as I know how to do. Hope this
helps.





Peter Kellner
http://peterkellner.net

 
Reply With Quote
 
Arjen
Guest
Posts: n/a
 
      08-02-2005
Okay, thanks for the link!
Arjen


<(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed) om...
>
> I think that you want a variable that is global within the scope of a
> page.
> If that's what you want use HttpContext.Current.Items in your external
> class files
> or
> Context.Items in your aspx & global.asax file
>
> An overview of global data in asp.net can be found here :
> http://msdn.microsoft.com/msdnmag/is...PNETUserState/
>
> I hope it helps...
> Let me know if you have any more questions..
>
> Cheers,
> Tom Pester
>
>> Hi,
>>
>> How can I make some variables global (public available) with the
>> global.asax file inside asp.net 2.0?
>>
>> - I want to access these variables from code-behind files (and maybe
>> from
>> aspx files).
>> - The global.asax haves no code-behind file.
>> - I want to set the values of the public variables inside the
>> Application_BeginRequest method.
>> Thanks!
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments