473,441 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

App_localresources not working with directories

16
hey, cant find how to solve this thing,

i have a test project with the following directory structure:


/root/pages/default.aspx
/root/App_LocalResources/default.aspx.resx
/root/App_LocalResources/default.aspx.fr.resx

using the following simple code:

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestLocale._Default" UICulture="auto:en-US" Culture="auto:en-US"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text="Label" meta:resourceKey="Label1"></asp:Label> </div> </form> </body> </html>
  4.  
at the resx file i have simple mapping for Label1.Text ,

The problem: for ssome reason ASP.NET can't find local resources when my default page is not at the root folder in the project,
when i place the default.aspx in the root project the localization works, when i place the default.aspx inside a folder it doesnt work
i have been searching everywhere and couldnt find how to make it work when using folders.

any kind of help would help!

thank you.
Apr 13 '10 #1

✓ answered by Frinavale

Both global and local resources are implemented using a very particular folder naming scheme that allows ASP.NET to dynamically find and compile your .Resx resources as part of the pre-compilation for the Web site.

This means that resources can be deployed easily with your application and ASP.NET will handle compilation and placement of the resource assemblies.

The scheme works with an App_GlobalResources folder at the root of the Web site and an App_LocalResources folder for each directory of the site.

You cannot change this structure because ASP.NET will not be able to locate the resources since the resources are located relative to the page that uses them. Since you are using local resources, your resources must be it a folder called App_LocalResources that is in the same directory as the web page that uses them.


Have you tried creating an App_LocalResource folder within the folder where you are moving your page to? Did you move the resources for the page into the App_LocalResource folder that is in the new folder?


-Frinny

5 10392
Frinavale
9,735 Expert Mod 8TB
Check out this article: ASP.NET Web Page Resources Overview.

Currently you are using Local Resource Files and these resource file are found relative to the page that uses them.

I think you might be interested in using Global Resource Files instead...but you should decide after reading the article.

-Frinny
Apr 13 '10 #2
shnizle
16
@Frinavale
I have read this article a few times also watched some video tutorials , i need to use local resources the question is why it doesn't work if my page is inside a directory and not in the root folder of the web application.

how do i make it work with folders???
Apr 13 '10 #3
Frinavale
9,735 Expert Mod 8TB
Both global and local resources are implemented using a very particular folder naming scheme that allows ASP.NET to dynamically find and compile your .Resx resources as part of the pre-compilation for the Web site.

This means that resources can be deployed easily with your application and ASP.NET will handle compilation and placement of the resource assemblies.

The scheme works with an App_GlobalResources folder at the root of the Web site and an App_LocalResources folder for each directory of the site.

You cannot change this structure because ASP.NET will not be able to locate the resources since the resources are located relative to the page that uses them. Since you are using local resources, your resources must be it a folder called App_LocalResources that is in the same directory as the web page that uses them.


Have you tried creating an App_LocalResource folder within the folder where you are moving your page to? Did you move the resources for the page into the App_LocalResource folder that is in the new folder?


-Frinny
Apr 13 '10 #4
shnizle
16
thanks alot it worked
Apr 13 '10 #5
Thank You. It worked for me
Feb 25 '16 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can...
1
by: Steve Franks | last post by:
I'd like to set up a certain part of my web tree so that no browsers can access files from that directory and any directories below it. I will store certain resouces like xml files and other...
0
by: Frustrated User | last post by:
Hello, Here is the scenario I need wome help with. An ASP.Net 2.0 web application with the following structure and content: Root Root/App_LocalResources...
0
by: schneider | last post by:
Hi all, I created a User Control "SlideShow.ascx" in my application's root. Then I created a subfolder and an aspx page "MySlideShow1.aspx" in there. I added an instance of the ascx control to...
63
by: David Mathog | last post by:
There have been a series of questions about directory operations, all of which have been answered with "there is no portable way to do this". This raises the perfectly reasonable question, why,...
0
by: Gabriel | last post by:
Hello, Several pages are bilingual, I use App_LocalResources. Example for the page Default.aspx the files Default.aspx.fr.resx and Default.aspx.resx The language loaded is browser language...
4
by: Edwin Velez | last post by:
http://msdn.microsoft.com/en-us/library/806sc8c5.aspx The URL above gives sample code for use within a Console Application. What I would like to do is use this code within a Windows Form. That...
6
by: Tim Arnold | last post by:
I have a bunch of processes to run and each one needs its own working directory. I'd also like to know when all of the processes are finished. (1) First thought was threads, until I saw that...
0
by: Cameron Simpson | last post by:
On 24Sep2008 18:27, Tim Arnold <a_jtim@bellsouth.netwrote: | I have a bunch of processes to run and each one needs its own working | directory. I'd also like to know when all of the processes are...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
0
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...
1
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...
0
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,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.