In my ASP,NET Web Portal, I am using the above code to do the 'Translation' functionality. Actually the need is allow a Administrator to define the translation of the Web-Pages for the various languages at runtime.
This all is happening at the run time.
But the probelm is once the system saves the file after writing, it clears the Session, Cache and Application state. Clearing these State objects definietly leads to halt in the Web-Application and ultimately throws the flow of control
to Login page.
i.e. It is behaving the way we encounter, after wriiting into Web.config / Global.asax at runtime.
Any changes made to resource files or files under /bin folder will lead to an application restart clearing your session/application variables. This restart is actually neccessary because the ASP.NET runtime needs to load the new/modified values fromthe changed
files and clear its old cache (for e.g. it caches the resource files values to avoid multiple reads to the files).
As far as I know you cannot avoid this if you are changing the files at runtime. What you can do is to use Database instead of resource files for this runtime "translation".
arunmanglick
Member
23 Points
57 Posts
Writing into .resx file using 'ResXResourceWriter' at runtime, clears the Session, Cache, Applica...
Mar 27, 2007 02:19 PM|LINK
See the below code:
//-------------------------------------------------
1 ResXResourceWriter rw = new ResXResourceWriter("MyResource.aspx.en-GB.resx");
2 rw.AddResource("StringData", "My String");
3 rw.AddResource("IntegerData", 2);
4 ........
5 rw.Close();
//-------------------------------------------------
In my ASP,NET Web Portal, I am using the above code to do the 'Translation' functionality. Actually the need is allow a Administrator to define the translation of the Web-Pages for the various languages at runtime.
This all is happening at the run time.
But the probelm is once the system saves the file after writing, it clears the Session, Cache and Application state. Clearing these State objects definietly leads to halt in the Web-Application and ultimately throws the flow of control to Login page.
i.e. It is behaving the way we encounter, after wriiting into Web.config / Global.asax at runtime.
Please help asap.
localization Translation Satellite assembly ASP.NET
vivek_iit
All-Star
17778 Points
3189 Posts
MVP
Re: Writing into .resx file using 'ResXResourceWriter' at runtime, clears the Session, Cache, App...
Mar 28, 2007 04:58 AM|LINK
Any changes made to resource files or files under /bin folder will lead to an application restart clearing your session/application variables. This restart is actually neccessary because the ASP.NET runtime needs to load the new/modified values fromthe changed files and clear its old cache (for e.g. it caches the resource files values to avoid multiple reads to the files).
As far as I know you cannot avoid this if you are changing the files at runtime. What you can do is to use Database instead of resource files for this runtime "translation".
Hope this helps,
Vivek
Communifire: Social Networking and Business Collaboration Platform
arunmanglick
Member
23 Points
57 Posts
Re: Writing into .resx file using 'ResXResourceWriter' at runtime, clears the Session, Cache, App...
Mar 28, 2007 07:15 AM|LINK
Thanks Vivek. I understand the root cause, but still looking for some Trick.
savas_murat
Member
43 Points
11 Posts
Re: Writing into .resx file using 'ResXResourceWriter' at runtime, clears the Session, Cache, App...
Mar 17, 2010 09:03 PM|LINK
Did you find a trick to that? I am having the same issue.
Danielj86
Member
2 Points
1 Post
Re: Writing into .resx file using 'ResXResourceWriter' at runtime, clears the Session, Cache, App...
Nov 20, 2012 08:44 AM|LINK
Make sure Resources.resx is not read-only