Reputation: 7438
I have a simple question
Is it possible to download a specific resource file from a visible aspx page in my internet browser?
Just the way we do download .js (javascript) files.
I want to download Spanish (es-MX) resx file of a visible aspx page which is showing in spanish.
Upvotes: 0
Views: 1117
Reputation: 1878
Resx files aren't served up by the web server (which is a good thing, because some developers store things in there that should not be made public.)
The answer to this question describes how to create a handler that will output the contents of a resx file, where the variable 'name' is the filename of your resx file.
Response.TransmitFile(Server.MapPath("~/App_LocalResources/" + name))
EDIT: some extra detail
Having created your handler (let's call it GetResources.ashx), you would pass the filename to the handler using a querystring parameter. For example,
GetResources.ashx?name=Default.es-MX.resx
In the handler:
string name = Request.QueryString["name"].ToString(); // but check for null etc.
It's not a good idea to have this handler on your production site in a public directory, so either password protect it, or remove it entirely from your release version.
Upvotes: 1