472,958 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Global.asax and Web.Config

I've created an <appSettingsvariable called "AppStartTime". Within the
Global.asax file in the Application_Start procedure I want to set the
"AppStartTime" to the current time. How can I access this variable in the
Global.asax file and set or read it's value? I know how to do it in a regular
..aspx.cs file, but not in the Global.asax file.
Sep 16 '08 #1
3 5485
Hi.

I can read the keys from Global.asax using:
string key = ConfigurationManager.AppSettings["key"];

Tommy.

On Tue, 16 Sep 2008 10:54:01 -0700, Greg <Ac**********@newsgroups.nospamwrote:
>I've created an <appSettingsvariable called "AppStartTime". Within the
Global.asax file in the Application_Start procedure I want to set the
"AppStartTime" to the current time. How can I access this variable in the
Global.asax file and set or read it's value? I know how to do it in a regular
.aspx.cs file, but not in the Global.asax file.
Sep 16 '08 #2
On Sep 16, 1:54*pm, Greg <AccessVBA...@newsgroups.nospamwrote:
I've created an <appSettingsvariable called "AppStartTime". Within the
Global.asax file in the Application_Start procedure I want to set the
"AppStartTime" to the current time. How can I access this variable in the
Global.asax file and set or read it's value? I know how to do it in a regular
.aspx.cs file, but not in the Global.asax file.
IIRC It's read only.
What ou can do is store the value in either Session or Application
scope.
Sep 16 '08 #3

"Greg" <Ac**********@newsgroups.nospamwrote in message
news:68**********************************@microsof t.com...
I've created an <appSettingsvariable called "AppStartTime". Within the
Global.asax file in the Application_Start procedure I want to set the
"AppStartTime" to the current time. How can I access this variable in the
Global.asax file and set or read it's value? I know how to do it in a
regular
.aspx.cs file, but not in the Global.asax file.
Modifing the WebConfig cause the application to restart. Hence if you
modify the web.config during application start you going to create an
infinite loop.

Web.Config is not the place to store this sort of info. Record it in
another xml or txt file or record it in a DB.

--
Anthony Jones - MVP ASP/ASP.NET

Sep 16 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
I have two projects - they both need to use the same web.config file, the same global.asax file, and share a common "look and feel" via several user controls. Is there an easy way for two...
6
by: Andrea Williams | last post by:
Where is the best place to put global variables. In traditional ASP I used to put all of them into an include file and include it in every page. Will the Global.aspx.cs do that same thing? ...
3
by: hansiman | last post by:
I use Application_Start in global.asax to set some physical folder paths ie.: Application("pdf") = "c:\www\<site>\pdf\" global.asax uses code behind. When I move the project from the dev to...
22
by: fd123456 | last post by:
Hi Tom ! Sorry about the messy quoting, Google is playing tricks on me at the moment. > Global.asax is where you normally have the Global Application > and Session variables and code to...
12
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it...
8
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical...
1
by: Anonieko | last post by:
Global.asax? Use HttpModules Instead! In a previous post, I talked about HttpHandlers - an underused but incredibly useful feature of ASP.NET. Today I want to talk about HttpModules, which are...
8
by: Doug | last post by:
Visual Studio 2005, SQL Server 2000, ASP.NET/VB.NET Not allowed to use the ASPNET machine account in SQL Server (very strict environment). Need to use Windows authentication, so we use...
1
by: teo | last post by:
I put some variables in a web.config file I have a global.asax file that needs to use one of those variables How can global.asax read that value? If I have more than one web.config ...
5
by: Eric Layman | last post by:
Hi everyone, Currently Im using Global.asax.vb to capture any errors and to send them via email to me. But I didn't get any emails when I purposely crash the web application. May I know what...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.