Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Where do I put user changeable parameters now in 2.0? (global.asax)

Reply
Thread Tools

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

 
 
gordonfmoore@yahoo.co.uk
Guest
Posts: n/a
 
      12-08-2005
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(object sender, System.EventArgs e)
{
myLabel.Text = (string) Application["PageHeading"];
string mydbfile = (string) Application["MDBDefault"];
string myLinkToUrl = (string) Application["DefaultWebpage"];
}

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

protected void Application_OnStart()
{
Application["PageHeading"] = "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

 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      12-08-2005
All these "configuration" 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!



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.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(object sender, System.EventArgs e)
> {
> myLabel.Text = (string) Application["PageHeading"];
> string mydbfile = (string) Application["MDBDefault"];
> string myLinkToUrl = (string) Application["DefaultWebpage"];
> }
>
> //in my global.asax file
> <script language = "c#" runat="server">
>
> protected void Application_OnStart()
> {
> Application["PageHeading"] = "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
>



 
Reply With Quote
 
 
 
 
clintonG
Guest
Posts: n/a
 
      12-09-2005
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:upAHwHF$(E-Mail Removed)...
> All these "configuration" 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!
>
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.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(object sender, System.EventArgs e)
>> {
>> myLabel.Text = (string) Application["PageHeading"];
>> string mydbfile = (string) Application["MDBDefault"];
>> string myLinkToUrl = (string) Application["DefaultWebpage"];
>> }
>>
>> //in my global.asax file
>> <script language = "c#" runat="server">
>>
>> protected void Application_OnStart()
>> {
>> Application["PageHeading"] = "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
>>

>
>



 
Reply With Quote
 
gordonfmoore@yahoo.co.uk
Guest
Posts: n/a
 
      12-10-2005
Thanks guys, that helped. I hadn't realised that web.config could be
used for this.

Clinton, you are probably right

 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does the following with Queue, q.put('\x02', True) not put itin the queue? Gabriel Rossetti Python 3 04-25-2008 03:41 PM
User-changeable colours Tim Green Javascript 4 06-20-2005 11:18 PM
if I define a function with no parameters, should i put void? TTroy C Programming 12 02-18-2005 11:00 AM
Digi camera w/ changeable lens's Tim V. Digital Photography 34 07-12-2004 06:19 AM
Picture and text changeable on a page Treetop Javascript 0 01-14-2004 04:09 PM



Advertisments