I am working on the old application where many pages have resource file. Each file structure is(.aspx file, .aspx.vb file, and aspx.resx file).
Now I have added the new file by following MSDN resource.
https://msdn.microsoft.com/en-us/library/0hds5k93.aspx
In that file I can see the .aspx file, .aspx.vb file and the aspx.designer.vb file but I can't find the .aspx.resx file.
Can someone please help to create the resource file as existing files?
The resx files are located inside the App_LocalResources folder for page specific resource files or in the App_GlobalResources folder for globally accessible resource files.
If that folder does not exist you can add it to the project by right clicking on the project name and select Add > Add ASP.NET Folder.
Related
I've been working with webforms and recently started to work with mvc. With webforms, when we use to push to the qa/prod server, we alway copied over the files. leaving behind the .cs files, so just the .aspx, bin folder, along with associated js/css files would go.
with mvc, if we are copying the directory over from our pc (where we develop), what files are needed, do we need the .cshtml files for example? I just want to avoid having to push all the files if they are not needed.
They are definitely not all required. What you are going to want to do is setup a way to publish, this ranges from doing a "bin deploy" to feeding in ftp settings and using a "single click deploy" approach.
What it all boils down to though is this. You will need
A bin folder with every relevant .dll
A content folder with relevant images and css files
A script folder with relevant .js scripts
A views folder with nested folders for views with relevant .cshtml files
A .webconfig file in the views folder and also one at the very root
The packages.xml file at the very root
The global.asax file with markup pointing to the application starting in global.asax.cs
What this excludes is every single .cs file. These will all be composed into your projects .dll. So if you are developing FunWebApp, then all your c# will be rolled into FunWebApp.dll in your bin folder.
Use the Visual studio "Publish" option available on your UI Project. This will generates all the required files you neeeds includes, bin folder, Views folder(which will have the .cshtml files),Content folder,Script folder, Config file(web.config) etc.
Right click on your project and select "Publish". You will be shown a wizard where you can define what kind of publish you want. You have different options like FTP, File system etc.
You will not see the Controllers folder / Other class files because code inside that folder is compiled to your assembly which is in the Bin folder
I feel like asking a dumb question, but I just do not see the options I need in Visual Studio 2010 File Properties. The only options I see are: File Name, and Full Path. What I need to set is: Build Action, and Copy To Output Directory.
Question update:
I just found out that File Properties shows the Advanced options for files in class libraries, but not for files from the actual web site. But how do I set the mentioned options to the resource file App_GlobalResources/Contact.resx , which by default does not appear in the published version of the web project?
From ASP.NET Precompilation Overview
Resources (.resx) files:
For .resx files in the App_GlobalResources folders, generates an
assembly or assemblies and a culture structure. For .resx files in the
App_LocalResources folders, copies files as is to the
App_LocalResources folder of the output location.
Assemblies are put in the Bin folder
I am working on a solution which has two projects in it. One is a virtual app which works in another. The first application is the panel and the second is the website. First application can be accessed with "localhost:10001/panel" and the second with "localhost:10001". You see, I created a virtual path for the first app to work under the second one in Visual Studio and they work great that way.
The problem I am having now is about the file uplaod system, "Blueimp's jQuery-File-Upload" plugin and as backend using "Backload". I must say that these work great on a standalone project. That's why I decided to continue the project using these.
But when it comes to a setup which I explained below, I cannot access the files I upload. I installed fileupload system in the panel project, which is accessed as "localhost:10001/panel" so when I leave the default web.config configuration for backload (default is "~/files"), all files are uploaded to the "localhost:10001/panel/files" path. And after the upload when I refresh the page, all uploaded file links are referencing "localhost:10001/files/" without the "panel" folder.
In BackLoad web.config notes how to change and use root upload folders are explained like that
filesRoot: // Root upload folder. If the value starts with '~/' (e.g. ~/files) the path is relative to the web root, otherwise set an absolute local path (e.g. d:/files) [Default: "~/Files"].
I understand that having "~/" at the beggining of a folder reference shows the project's root. But I can't figure out how to reference the upload folder, instead of the default "~/files", to upload and access all files from the second project's root. When I need to reference folder between these two projects I simple use "../", or "/" to access the second project's (site) root. But doing that in "filesRoot" attribute of BackLoad config settings, all file references are starting "///file....." and shows a local path in the computer.
I simply want to upload and access the files from the "localhost:10001/files" location when I upload files from the panel. Now, I cannot even use the "localhost:10001/panel/files" path because files are uploaded to "panel/files" folder, but are accessed from "files" folder with default settings.
BTW: I am using BackLoad's WebForms Example on this project, and this is a Web Forms project.
I ended up using Files folder as a temp folder. At the time of submit, I move the file which is uploaded in Files folder, to the folder of my need. And the problem is solved.
Thanks anyway...
We use RESX files to manage translatable text labels published from a Content Management System.
In the past we would simply publish the labels to the folder App_GlobalResources folder, and use the following code to retrieve a label from the application:
System.Web.HttpContext.GetGlobalResourceObject("labels", "key_name")
However, we've recently worked on an implementation that has a PrecompiledApp.Config file.
I understand this means we can't have a App_GlobalResources folder.
Is there anyway we can continue to use resx files in this scenario?
I have created a few classes that operate separately from the normal aspx.cs files. When I added a new class I was prompted to add these to app_data, i did. So I copied out these files and the app_data folder and it cannot be found. I tried the .cs files at the root of the website and they still could not be found.
I'm sure i'm messing up on a common mistake.
Thanks!
They need to be in the App_Code folder.