I was wondering how to add an app_code folder in console application but could not find that, however I was able to add app_code folder to a website application. Sorry I am newbie don't know much?
app_code folder is in use for ASP.Net Application there is no use of the folder in console application. Could you please explain it clearly why you want to use the folder? For more details you can see link given below.
http://www.bayt.com/en/specialties/q/937/why-do-you-use-the-app_code-folder-in-asp-net/
Related
I know that we can't use physical path when the webpage is deployed.
But here is my problem: I'm developing an Application for C# winform and Asp.net webform, the Data folder for the app is huge and I need to put that folder separately from the projects' folders cause it would be convenient to backup my projects to Google drive. The C# winform is easy to link the physical path, but the asp.net webform forces me to put the Data folder inside the project.
My current solution is: putting the Data folder inside the asp.net webform project and link that folder to the C# winform. But it wouldn't be convenient to backup the webform.
But is there any way I can use physical path with asp.net webform just for testing?
Thanks for reading.
You can put the folder external to web app folder, then place the path in Web.Config Under AppSettings as
<appSettings>
<add name="Data_Folder_Path" value="C:\Path\to\Data\Folder" />
</appSettings>
Then in code behind or elsewheere you need the data path you use Configuration class to read the path value:
var dataFolderPath = System.Configuration.ConfigurationManager.AppSettings["Data_Folder_Path"]
You can make use of server.mappath as shown below
Server.MapPath("~/" + folderName + nameOfFile)
to get the location of the files.
You may save the names of the files on your database and retrieve them when needed.
I've inherited an MVC3 .NET web app, which had all the controllers for the site in a separate project to the main web app. Not sure why this was the case. As it's a small app, I decided (for "neatness") to move the controller code back into the main web project, under the usual "Controllers" folder.
"Controllers" project folders:
Admin
Members
Config
Moved above code into main Web project under "Controllers" folder, ie:
Controllers
Admin
Members
Config
The problem now is, all the links generated by the code include "/Controllers/" in the path, assumedly because the controller code is now in a "Controllers" project folder. Is this a simple MVC issue to fix? Or would it likely be a flaw in code itself, in that it relies on where the code files run from to generate links?
Is it possible to build a CMS on top of CodeIgniter where the CMS files is separate from customization files? What I mean is, like CodeIgniter by default comes with 2 main folder, application and system folder. So, all your own files is placed in application folder so that next time you can easily update CodeIgniter by overriding the system folder and everything will still working fine.
So, can I store my files at custom folder?
E.g.:
system folder - codeigniter
my_system folder - CMS
application folder - All customization on each individual projects
You may use CodeIgniter's native application "Package", you can find the doc here : http://ellislab.com/codeigniter/user-guide/libraries/loader.html
You can store your file where you want expect system folder as you written. best approach is make folder on root named public or you want and put your file.
system folder contains everything codeigniter needs. application folder contains your specific code - it defaults to showing the welcome page.
consider naming your system folder with the codeigniter version number and date
makes it easier when you are upgrading
and you can easily switch to different versions directly from the index.php page by editing the file path to the folders
I am trying to enable view compilation to have my ASP.NET MVC3 web site load faster. My web site is hosted on AppHarbor.
However, my views make use of MVC3 view helpers, defined in the App_Code folder.
When I try to load my web-site, I get:
"The directory '/App_Code/' is not allowed because the application is precompiled."
How can I stop the App_Code folder being deployed to the web-server, but still have the App_Code helpers pre-compiled?
I've tried changing the helpers to Content=None, but this leads to an AppHarbor build error because the helper files cannot be found during pre-compilation.
Old question, but I just got that problem, and the following procedure has worked for me:
Go to https://appharbor.com/your-application.
Click on Settings.
Click on Build | DISABLE PRECOMPILATION.
Force appharbor to do a rebuild/redeploy (by pushing a new commit to the repository).
I have just deleted my shared helpers and deleted the App_Code folder because of this problem. I have changed my project to use partial views instead .
According to this answer helpers must be in the App_Code folder but this won't work using AppHarbor.
I would say , don't use App_Code folder in web application. Please find more details ****here****
Running under Server08 | IIS7. I have a website project and am in the habit of hand editing the Global.asax.cs at the deployed site many times in the past. Recently I've found that only the Global.asax is present and has only:
<%# Application Codebehind="Global.asax.cs" Inherits="myDomain.MvcApplication" Language="C#" %>
There are simply no Global.asax.cs files present/visible for any of my active, functioning websites anymore.
I've checked here Global.asax can't find code-behind class and here where is the codes in Global.asax in mvc3? without getting anywhere. The second link contains the comment: 'That's because it's a compiled web application. You'll have to view it in Visual Studio as a project.'
But since my project has always been a website - and I've not converted it (intentionally) I'm puzzled by the changed behavior.
But when i step into VS12 and look at the context menu for the solution's WebProject it presents 'Convert to Web Application'. The sites' folder structures do not contain App_Data or App_Start. To my mind, these 2 fact establish at VS is treating the project as a website, why then, is the Global.cs compiled down to the /bin?
I'll close by repeating - I've hand edited these things in the past - I'm not positive but it's probably accurate to say that this is the first time I've tried to do so after installing VS12. And, coming to think on it harder - it's only recently that I've implemented the 'One Click Publishing' service so that could be coming into play.
verify? I'd like I need to edit a simple update without full re-deployment.
thx
I think the 'One Click Publishing' is most likely the culprit here. I created a sample Web Site project to experiment, and when I use the publish feature in Visual Studio, the files generated are indeed missing the Global.asax.cs file. Instead, a bin folder is created with a compilation called "App_global.asax.dll" even though it is a Web Site and not a Web Application. I am guessing this might be similar to what is happening for you as well.
If not, I found a link which might be useful to you in order to once again be able to edit a class on the server. Particularly, have a look at the second answer (the one not accepted as the best answer) to recreate a class file for the global code: Where is the Global.asax.cs file?
I tried this solution, and verified that the class file is editable on the server, and that it is dynamically compiled at run time (the modifications I made to the file worked immediately).
Hope this helps!
After editing the global.asax you need to rebuild and upload the DLL to the bin folder. Otherwise, your changes will not take effect.
You might be able to upload an web version of the global.asax that includes the code in that one file, which obviously does not require a .cs code behind. I used to do it with aspx files in an application but I have never tried it in the GLobal.asax file.