Global resource file

M

martin

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
 
M

martin

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 said:
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 said:
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
 
A

Alvin Bruney [MVP]

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 said:
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 said:
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 said:
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
 
M

martin

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 said:
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 said:
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 said:
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
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 success
or
 
A

Alvin Bruney [MVP]

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 said:
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 said:
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 said:
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
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
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
file
 
M

martin

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 said:
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 said:
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 said:
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
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
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top