sin
sin

Reputation: 706

accessing a resource file using asp.net

how to access resource file using asp.net framework?? what is the code to access resource file from default.aspx?? where it is to be inserted? please tell me the steps precisely? thanks!!

Upvotes: 0

Views: 1432

Answers (2)

Krishnan
Krishnan

Reputation: 1504

So, this is the code-behind way of accessing the resource. How to access a resource (which is in the Project) from an aspx page.

I've tried the implicit and explicit techniques: by using meta:keywords="Yourresourcekey", and <%$ Resources:ClassName, Keyword %>

Upvotes: 0

Robbie Tapping
Robbie Tapping

Reputation: 2556

You can use the following command:

 this.GetGlobalResourceObject("YourclassName", "Yourresourcekey");

or

if the Resource is in the Project as a Resource file.

you do something like:

var o = MyProject.Resource1.Setting;

where MyProject is the ProjectName, and the Resource1 is the name of the Resource inside the project.

Upvotes: 1

Related Questions