468,257 Members | 1,408 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

Global resource file

Hi,

I have noticed that every aspx page that I created (and ascx file) has an
assosiated resource file aspx.resx.
However what I would like to do is have a single global resource file for
the site.
The resources in this global resource file will possibly change quite often,
there I guess this rules out using web.config as every time web.config
alters the application is recompiled, also I am not sure of the possible
consequences of dynamically changing web.config.

I was thinking that I could use the resource file of global asax as a global
resource file however I am unsure of whether that is what this file is for
or if it is exclusivly for global.asax.

I guess my only option is an XML file. I have ruled a database out as a
means to store global resources.
The main resources that I wish to store are strings to signify success or
faliure messages on a website.

cheers

martin


Nov 18 '05 #1
6 2354
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:OU*************@TK2MSFTNGP11.phx.gbl...
Hi,

I have noticed that every aspx page that I created (and ascx file) has an assosiated resource file aspx.resx.
However what I would like to do is have a single global resource file for
the site.
The resources in this global resource file will possibly change quite often, there I guess this rules out using web.config as every time web.config
alters the application is recompiled, also I am not sure of the possible
consequences of dynamically changing web.config.

I was thinking that I could use the resource file of global asax as a global resource file however I am unsure of whether that is what this file is for
or if it is exclusivly for global.asax.

I guess my only option is an XML file. I have ruled a database out as a
means to store global resources.
The main resources that I wish to store are strings to signify success or
faliure messages on a website.

cheers

martin

Nov 18 '05 #2
Hi Alvin,

No really resolved it.

can uses an xml file to hold all of my strings for error messages

eg
<Errors>
<Key ErrNum="1" value="Must enter a date"/>
<Key ErrNum="2" value="A fatal error occured -- closing program"/>
<Key ErrNum="3" value="An non fatal error ccured"/>
</Errors>

however, I am unsure about concurency issues such as a number of users
accessing the strings at the same time.
No one will ever write to this xml resources file except me.
I don't want me writing to it to ever cause an error, and I don't want
errors to happen when a certain number of users try to read the file.
I especially don't want to hold these values in a database as I will retrive
them often.

I did think about caching the error XML file in memory but it will be quite
large.

any ideas would be appreciated.

cheers

martin.
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OD**************@tk2msftngp13.phx.gbl...
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:OU*************@TK2MSFTNGP11.phx.gbl...
Hi,

I have noticed that every aspx page that I created (and ascx file) has
an
assosiated resource file aspx.resx.
However what I would like to do is have a single global resource file

for the site.
The resources in this global resource file will possibly change quite

often,
there I guess this rules out using web.config as every time web.config
alters the application is recompiled, also I am not sure of the possible
consequences of dynamically changing web.config.

I was thinking that I could use the resource file of global asax as a

global
resource file however I am unsure of whether that is what this file is for or if it is exclusivly for global.asax.

I guess my only option is an XML file. I have ruled a database out as a
means to store global resources.
The main resources that I wish to store are strings to signify success or faliure messages on a website.

cheers

martin


Nov 18 '05 #3
when you try to write to the resource file, obtain a write lock on the file.
This will prevent concurrency issues.

lock(filereference)
{
anything inside here is protected
}

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:eR*************@TK2MSFTNGP12.phx.gbl...
Hi Alvin,

No really resolved it.

can uses an xml file to hold all of my strings for error messages

eg
<Errors>
<Key ErrNum="1" value="Must enter a date"/>
<Key ErrNum="2" value="A fatal error occured -- closing program"/>
<Key ErrNum="3" value="An non fatal error ccured"/>
</Errors>

however, I am unsure about concurency issues such as a number of users
accessing the strings at the same time.
No one will ever write to this xml resources file except me.
I don't want me writing to it to ever cause an error, and I don't want
errors to happen when a certain number of users try to read the file.
I especially don't want to hold these values in a database as I will retrive them often.

I did think about caching the error XML file in memory but it will be quite large.

any ideas would be appreciated.

cheers

martin.
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OD**************@tk2msftngp13.phx.gbl...
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:OU*************@TK2MSFTNGP11.phx.gbl...
Hi,

I have noticed that every aspx page that I created (and ascx file) has
an
assosiated resource file aspx.resx.
However what I would like to do is have a single global resource file

for the site.
The resources in this global resource file will possibly change quite

often,
there I guess this rules out using web.config as every time web.config
alters the application is recompiled, also I am not sure of the possible consequences of dynamically changing web.config.

I was thinking that I could use the resource file of global asax as a

global
resource file however I am unsure of whether that is what this file is for or if it is exclusivly for global.asax.

I guess my only option is an XML file. I have ruled a database out as a means to store global resources.
The main resources that I wish to store are strings to signify success or faliure messages on a website.

cheers

martin



Nov 18 '05 #4
Thanks for that Alvin,

I have three questions if I may,

1. Is there a maximum number of users who can access a file at any one time,
I have always been under the impression that even if one user attemps to
access a file when another has it open then there will be a problem.

2. If i have a lock on a file, does it affect other uses who want to read
the file or just other sessions that want to write to the file, I guess I
can specify the type of lock.

3. Is caching the file a good idea and accessing it from memory rather than
accessing the file on disk all the time. I guess I could alway check "does
the value exist in the xml file in the cache" if it does then just read from
the cache otherwise load the file from disk into the cache.

thank for your input.

cheers

martin.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
when you try to write to the resource file, obtain a write lock on the file. This will prevent concurrency issues.

lock(filereference)
{
anything inside here is protected
}

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:eR*************@TK2MSFTNGP12.phx.gbl...
Hi Alvin,

No really resolved it.

can uses an xml file to hold all of my strings for error messages

eg
<Errors>
<Key ErrNum="1" value="Must enter a date"/>
<Key ErrNum="2" value="A fatal error occured -- closing program"/>
<Key ErrNum="3" value="An non fatal error ccured"/>
</Errors>

however, I am unsure about concurency issues such as a number of users
accessing the strings at the same time.
No one will ever write to this xml resources file except me.
I don't want me writing to it to ever cause an error, and I don't want
errors to happen when a certain number of users try to read the file.
I especially don't want to hold these values in a database as I will retrive
them often.

I did think about caching the error XML file in memory but it will be

quite
large.

any ideas would be appreciated.

cheers

martin.
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OD**************@tk2msftngp13.phx.gbl...
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:OU*************@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> I have noticed that every aspx page that I created (and ascx file)
has
an
> assosiated resource file aspx.resx.
> However what I would like to do is have a single global resource
file for
> the site.
> The resources in this global resource file will possibly change
quite often,
> there I guess this rules out using web.config as every time web.config > alters the application is recompiled, also I am not sure of the

possible > consequences of dynamically changing web.config.
>
> I was thinking that I could use the resource file of global asax as a global
> resource file however I am unsure of whether that is what this file
is for
> or if it is exclusivly for global.asax.
>
> I guess my only option is an XML file. I have ruled a database out
as a > means to store global resources.
> The main resources that I wish to store are strings to signify

success or
> faliure messages on a website.
>
> cheers
>
> martin
>
>
>
>



Nov 18 '05 #5
> 1. Is there a maximum number of users who can access a file at any one
time,
I have always been under the impression that even if one user attemps to
access a file when another has it open then there will be a problem. Usually, only one user should be writing to the file at any one point in
time, which is the reason for a lock. In the absence of a lock, multiple
users will be allowed to write to the file with unpredictable results.
2. If i have a lock on a file, does it affect other uses who want to read
the file or just other sessions that want to write to the file, I guess I
can specify the type of lock. It depends on the type of lock. A read lock prevents other users from
reading the file. A write lock prevents other users from writing to the
file. A read/write lock is queue.
3. Is caching the file a good idea and accessing it from memory rather than accessing the file on disk all the time. I guess I could alway check "does
the value exist in the xml file in the cache" if it does then just read from the cache otherwise load the file from disk into the cache. Disk I/O is always very expensive compared to an in-memory access. Weigh
this carefully against the required memory consumption of the file and make
a best judgement of where the file should reside, that is either in memory
or on disk.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:um*************@TK2MSFTNGP10.phx.gbl... Thanks for that Alvin,

I have three questions if I may,

1. Is there a maximum number of users who can access a file at any one time, I have always been under the impression that even if one user attemps to
access a file when another has it open then there will be a problem.

2. If i have a lock on a file, does it affect other uses who want to read
the file or just other sessions that want to write to the file, I guess I
can specify the type of lock.

3. Is caching the file a good idea and accessing it from memory rather than accessing the file on disk all the time. I guess I could alway check "does
the value exist in the xml file in the cache" if it does then just read from the cache otherwise load the file from disk into the cache.

thank for your input.

cheers

martin.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
when you try to write to the resource file, obtain a write lock on the file.
This will prevent concurrency issues.

lock(filereference)
{
anything inside here is protected
}

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:eR*************@TK2MSFTNGP12.phx.gbl...
Hi Alvin,

No really resolved it.

can uses an xml file to hold all of my strings for error messages

eg
<Errors>
<Key ErrNum="1" value="Must enter a date"/>
<Key ErrNum="2" value="A fatal error occured -- closing program"/> <Key ErrNum="3" value="An non fatal error ccured"/>
</Errors>

however, I am unsure about concurency issues such as a number of users
accessing the strings at the same time.
No one will ever write to this xml resources file except me.
I don't want me writing to it to ever cause an error, and I don't want
errors to happen when a certain number of users try to read the file.
I especially don't want to hold these values in a database as I will

retrive
them often.

I did think about caching the error XML file in memory but it will be

quite
large.

any ideas would be appreciated.

cheers

martin.
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OD**************@tk2msftngp13.phx.gbl...
> Your post went unanswered. Have you resolved this issue?
>
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "martin" <ma***************@hotmail.com> wrote in message
> news:OU*************@TK2MSFTNGP11.phx.gbl...
> > Hi,
> >
> > I have noticed that every aspx page that I created (and ascx file) has
> an
> > assosiated resource file aspx.resx.
> > However what I would like to do is have a single global resource file for
> > the site.
> > The resources in this global resource file will possibly change quite > often,
> > there I guess this rules out using web.config as every time web.config > > alters the application is recompiled, also I am not sure of the

possible
> > consequences of dynamically changing web.config.
> >
> > I was thinking that I could use the resource file of global asax
as a > global
> > resource file however I am unsure of whether that is what this
file
is for
> > or if it is exclusivly for global.asax.
> >
> > I guess my only option is an XML file. I have ruled a database out as
a
> > means to store global resources.
> > The main resources that I wish to store are strings to signify

success or
> > faliure messages on a website.
> >
> > cheers
> >
> > martin
> >
> >
> >
> >
>
>



Nov 18 '05 #6
Hi Alvin,

thanks for all your help,

I will weight the issues you mention up carefully before making a final
decision.

cheers

martin.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:uj**************@tk2msftngp13.phx.gbl...
1. Is there a maximum number of users who can access a file at any one time,
I have always been under the impression that even if one user attemps to
access a file when another has it open then there will be a problem.

Usually, only one user should be writing to the file at any one point in
time, which is the reason for a lock. In the absence of a lock, multiple
users will be allowed to write to the file with unpredictable results.
2. If i have a lock on a file, does it affect other uses who want to read the file or just other sessions that want to write to the file, I guess I can specify the type of lock.

It depends on the type of lock. A read lock prevents other users from
reading the file. A write lock prevents other users from writing to the
file. A read/write lock is queue.
3. Is caching the file a good idea and accessing it from memory rather

than
accessing the file on disk all the time. I guess I could alway check "does the value exist in the xml file in the cache" if it does then just read

from
the cache otherwise load the file from disk into the cache.

Disk I/O is always very expensive compared to an in-memory access. Weigh
this carefully against the required memory consumption of the file and

make a best judgement of where the file should reside, that is either in memory
or on disk.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:um*************@TK2MSFTNGP10.phx.gbl...
Thanks for that Alvin,

I have three questions if I may,

1. Is there a maximum number of users who can access a file at any one

time,
I have always been under the impression that even if one user attemps to
access a file when another has it open then there will be a problem.

2. If i have a lock on a file, does it affect other uses who want to read the file or just other sessions that want to write to the file, I guess I can specify the type of lock.

3. Is caching the file a good idea and accessing it from memory rather

than
accessing the file on disk all the time. I guess I could alway check "does the value exist in the xml file in the cache" if it does then just read

from
the cache otherwise load the file from disk into the cache.

thank for your input.

cheers

martin.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
when you try to write to the resource file, obtain a write lock on the

file.
This will prevent concurrency issues.

lock(filereference)
{
anything inside here is protected
}

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"martin" <ma***************@hotmail.com> wrote in message
news:eR*************@TK2MSFTNGP12.phx.gbl...
> Hi Alvin,
>
> No really resolved it.
>
> can uses an xml file to hold all of my strings for error messages
>
> eg
> <Errors>
> <Key ErrNum="1" value="Must enter a date"/>
> <Key ErrNum="2" value="A fatal error occured -- closing

program"/>
> <Key ErrNum="3" value="An non fatal error ccured"/>
> </Errors>
>
> however, I am unsure about concurency issues such as a number of users > accessing the strings at the same time.
> No one will ever write to this xml resources file except me.
> I don't want me writing to it to ever cause an error, and I don't want > errors to happen when a certain number of users try to read the file. > I especially don't want to hold these values in a database as I will
retrive
> them often.
>
> I did think about caching the error XML file in memory but it will be quite
> large.
>
> any ideas would be appreciated.
>
> cheers
>
> martin.
>
>
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message > news:OD**************@tk2msftngp13.phx.gbl...
> > Your post went unanswered. Have you resolved this issue?
> >
> > --
> > Regards,
> > Alvin Bruney [ASP.NET MVP]
> > Got tidbits? Get it here...
> > http://tinyurl.com/3he3b
> > "martin" <ma***************@hotmail.com> wrote in message
> > news:OU*************@TK2MSFTNGP11.phx.gbl...
> > > Hi,
> > >
> > > I have noticed that every aspx page that I created (and ascx

file)
> has
> > an
> > > assosiated resource file aspx.resx.
> > > However what I would like to do is have a single global resource

file
> for
> > > the site.
> > > The resources in this global resource file will possibly change

quite
> > often,
> > > there I guess this rules out using web.config as every time

web.config
> > > alters the application is recompiled, also I am not sure of the
possible
> > > consequences of dynamically changing web.config.
> > >
> > > I was thinking that I could use the resource file of global asax as
a
> > global
> > > resource file however I am unsure of whether that is what this

file
is
> for
> > > or if it is exclusivly for global.asax.
> > >
> > > I guess my only option is an XML file. I have ruled a database

out as
a
> > > means to store global resources.
> > > The main resources that I wish to store are strings to signify

success
> or
> > > faliure messages on a website.
> > >
> > > cheers
> > >
> > > martin
> > >
> > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Matt Calhoon | last post: by
5 posts views Thread by Daves | last post: by
4 posts views Thread by Omega | last post: by
3 posts views Thread by Jarmo Muukka | last post: by
37 posts views Thread by eoindeb | last post: by
reply views Thread by klemen.verdnik | last post: by
1 post views Thread by ttt.tas | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.