473,804 Members | 3,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Where do I put user changeable parameters now in 2.0? (global.asax)

Hi,

for some reason? I learnt it was sensible/useful to put any parameters
that I wanted users to be able to change in the global.asax file.

So my code would look like:

//in my page load
protected void Page_Load(objec t sender, System.EventArg s e)
{
myLabel.Text = (string) Application["PageHeadin g"];
string mydbfile = (string) Application["MDBDefault "];
string myLinkToUrl = (string) Application["DefaultWebpage "];
}

//in my global.asax file
<script language = "c#" runat="server">

protected void Application_OnS tart()
{
Application["PageHeadin g"] = "Maths Production (2.0)";
Application["DefaultWebpage "] = "http://intranet";
Application["MDBDefault "] = "App_Data/YAS.mdb";
}
</script>

This worked well under .net 1.1 with precompiled aspx.cs files (as a
dll)

However, they've done it to me again and now I have to fix what wasn't
broken under 2.0

If I use the (afterthought) web deployment projects add in, I can
compile my codebehind, but it also compiles my global.asax and so my
customers can't set up the system parameters as they want to.

So how do I now do this? Please. (I'm not really hacked off - honest!
:( )

Regards

Gordon

Dec 8 '05 #1
3 1281
All these "configurat ion" values should either be database driven (if they
need to be managed through an interface) or simply in the web.config. This
is likely the best way in both 1.x and 2.x.

You can either simply use the AppSettings section, or write your own
configuration handler and have a little section to yourself:
http://openmymind.net/index.aspx?documentId=5

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

<go**********@y ahoo.co.uk> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
Hi,

for some reason? I learnt it was sensible/useful to put any parameters
that I wanted users to be able to change in the global.asax file.

So my code would look like:

//in my page load
protected void Page_Load(objec t sender, System.EventArg s e)
{
myLabel.Text = (string) Application["PageHeadin g"];
string mydbfile = (string) Application["MDBDefault "];
string myLinkToUrl = (string) Application["DefaultWebpage "];
}

//in my global.asax file
<script language = "c#" runat="server">

protected void Application_OnS tart()
{
Application["PageHeadin g"] = "Maths Production (2.0)";
Application["DefaultWebpage "] = "http://intranet";
Application["MDBDefault "] = "App_Data/YAS.mdb";
}
</script>

This worked well under .net 1.1 with precompiled aspx.cs files (as a
dll)

However, they've done it to me again and now I have to fix what wasn't
broken under 2.0

If I use the (afterthought) web deployment projects add in, I can
compile my codebehind, but it also compiles my global.asax and so my
customers can't set up the system parameters as they want to.

So how do I now do this? Please. (I'm not really hacked off - honest!
:( )

Regards

Gordon

Dec 9 '05 #2
Hey Gordon, read these [1],[2] and if I might nitpick shouldn't your
parameters be written using camel case, i.e. pageHeading and so on?

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee. com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
[1] http://msdn2.microsoft.com/library/2...us,vs.80).aspx
[2]
http://msdn.microsoft.com/asp.net/co...erprofiles.asp

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:up******** ******@tk2msftn gp13.phx.gbl...
All these "configurat ion" values should either be database driven (if they
need to be managed through an interface) or simply in the web.config.
This is likely the best way in both 1.x and 2.x.

You can either simply use the AppSettings section, or write your own
configuration handler and have a little section to yourself:
http://openmymind.net/index.aspx?documentId=5

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

<go**********@y ahoo.co.uk> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
Hi,

for some reason? I learnt it was sensible/useful to put any parameters
that I wanted users to be able to change in the global.asax file.

So my code would look like:

//in my page load
protected void Page_Load(objec t sender, System.EventArg s e)
{
myLabel.Text = (string) Application["PageHeadin g"];
string mydbfile = (string) Application["MDBDefault "];
string myLinkToUrl = (string) Application["DefaultWebpage "];
}

//in my global.asax file
<script language = "c#" runat="server">

protected void Application_OnS tart()
{
Application["PageHeadin g"] = "Maths Production (2.0)";
Application["DefaultWebpage "] = "http://intranet";
Application["MDBDefault "] = "App_Data/YAS.mdb";
}
</script>

This worked well under .net 1.1 with precompiled aspx.cs files (as a
dll)

However, they've done it to me again and now I have to fix what wasn't
broken under 2.0

If I use the (afterthought) web deployment projects add in, I can
compile my codebehind, but it also compiles my global.asax and so my
customers can't set up the system parameters as they want to.

So how do I now do this? Please. (I'm not really hacked off - honest!
:( )

Regards

Gordon


Dec 9 '05 #3
Thanks guys, that helped. I hadn't realised that web.config could be
used for this.

Clinton, you are probably right :)

Dec 10 '05 #4

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

Similar topics

2
361
by: Alex Maghen | last post by:
It looks as if user imporsonation doesn't work in the Global.asax OnStart event. What this means is that if I have application configured to use "AlexUser" as the user for all ASP.NET stuff, that works for everything within my application EXCEPT that code executed in the OnStart in global.asax goes out as the "ASPNET" user This is a real problem because it means that I have to giver database permissions to the ASPNET user if I want to make...
5
3945
by: WJ | last post by:
I am attempting to use the Global.Asax to store my user's configuration. Here is the concept: 1. User logs on into the site using Form Authentication. 2. I capture the user Credential, verify it and then assign this Logon ID (user) a so called User's serverside cookie. 3. My system is configured to accept 1,024 concurrent users, this means that my Global.Asax will host no more than 1,024 Logon IDs and their associated cookies/variables....
5
1492
by: vbMental | last post by:
I am deep into a project and cannot get this to work correctly. I am trying to make a custom error page that will be able to know what exception occurred. I already know about the defaultRedirect page - <customErrors mode="on" defaultRedirect="Error.aspx"/> But how do I reference the exception that occurred from that page? If I cant, then should I use the Application_Error event in global.asax ? And if I do that, then what about hiding...
12
3841
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 (the oleDBConnection on global.asa.vb) at the other aspx pages ?
2
2356
by: tshad | last post by:
I have my error handling set up in Global.asax: Sub Application_Error(Sender As Object, E as EventArgs) In this procedure I call a function in a dll that will write out to a history file. This works for some errors, but not others. If it doesn't work, it stops there and the normal MS error page goes to the User.
19
10217
by: furiousmojo | last post by:
This is a strange problem. I have a project where the contents of global.asax application_error are not firing. It is an asp.net 2.0 application using web application projects. I have another app using web application projects and it's firing fine but it was upgraded from the 1.1 framework. Why doesn't my global.asax application_error routine fire?
3
5277
by: Peter Larsen [CPH] | last post by:
Hi, I have a problem where the code in Global.asax.cs runs before the unittests (on test of course). In the global file, i load some data from a Oracle table and save it in HttpApplicationState. This is happening in the Application_start function. The following unittest show the beginning of the method, where the database mock is created. If this mock isn't created, the unittest will try to access
1
869
by: Poggs | last post by:
Where do you put Global.asax methods in the web application? Can't seem to Add Global.asax in web application projects..
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9582
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9157
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.