Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to work with resx files in ASP.NET MVC 5

Posted on 2016-08-31
4
Medium Priority
?
302 Views
Last Modified: 2016-10-22
I'm wondering how to retrieve the strings of the resx files from the Razor View

<li>@Html.ActionLink("Contact", "Contact", "Home")</li>

Open in new window


I'm triying to call the resx file and retrieve the corresponding string this way:

<li>@Html.ActionLink([namespace.resourcefolder], "Contact", "Home")</li>

Open in new window


but I don't see the App_LocalResources in the Intellisense list after namespace

There is no much specific information about this on the internet
0
Comment
Question by:Miguel Quintana
  • 2
3 Comments
 
LVL 19

Assisted Solution

by:Manoj Patil
Manoj Patil earned 2000 total points
ID: 41779319
0
 

Assisted Solution

by:Miguel Quintana
Miguel Quintana earned 0 total points
ID: 41784612
Thank you, I have read that article before.

I found this way easier ASP.NET 4 MVC 5 Multi language web-application  however I cannot manage neither calling a custom folder named "Resources" containing  the resx files nor an ASP.NET special folder "App_GlobalResources"

If I create a project from scratch I manage to call the resx files with no issues but then I continue creating other classes and loss all links to these files getting this error: The name 'Resources' does not exist in the current context
0
 

Accepted Solution

by:
Miguel Quintana earned 0 total points
ID: 41784641
Will try this as well and test:

http://www.devcurry.com/2013/02/aspnet-mvc-using-resource-files-to.html

Bringing in Resource Files
Resource files as we all know are xml files with .resx extension and have a dedicated designer to manipulate them in Visual Studio.

Now in the olden days, one would drop resource files in the App_LocalResources folder. However that prevents you from sharing Resources in the Domain layer for example. To avoid this scenario, we add a new Class Library project to our MVC solution and add a new Resource file to it.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question