How to get ASP.NET website precompilation to exclude a certain folder - asp.net

The several different environments (e.g. live, demo etc) of my web app are differentiated by config settings in a folder called EnvironmentConfiguration. Whenever I update one of the sites, I delete the EnvironmentConfiguration folder from the precompiled site before copying the website files over (i.e. in order that the EnvironmentConfiguration folder in the deployment location is not replaced).
Just to save mistakes, is there a way I can get Visual Studio not to produce the EnvironmentConfiguration folder when it precompiles the site for me?

You could try a couple of things.
1) Right click on the folder in the solution and select exclude from Project.
2) Look at each of the files in the folder and set the BuildAction property to 'None' rather than 'Content'

Related

PDF is not accessible through URL in IIS .NET Framework 4.8 app

I have a PDF file in a folder on a server within a IIS website app that I need to be able to open through a link/url, like below:
https://api.example.com/my-path/my-pdf-file.pdf
The PDF file is hosted in a folder of my IIS application. When I try to access it through the link, I've got a 500 server error.
I tried several things within IIS settings (URL Rules, web.config, mime-types), but nothing worked so far.
Any advice will be much appreciated.
Is the folder included in the project? You can't just add a folder outside of Visual Studio, but have to use VS to add that folder.
You can right click on that existing folder (which of course is a sub folder of your project) and check this setting:
So, in my case, I right click on UpLoadFiles.
If the folder ALREADY is included in the project, then you get a option to EXCLUDE the folder like this:
However, if the folder is not included, then you see this:
so, is that folder included in your project? You want to check above.

Bluimp Backload folder reference issue with virtual directories

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...

Created folder in VS2012 is missing on the server

I have very strange problem and I don't even know why it occurs. Maybe I'm doing something wrong.
So i have created new website in VB2012. Then i've created new folder and uploaded everything on my host. But this folder is missing on the server. Why is that and how to fix it? Do i need to create desired folders on my host manually?
Folder named "photos" added in my website project
Folder is missing on the server when I upload that project
Empty directories are not published when using Visual Studio.
The top answer to this question regarding a similar issue suggests a workaround:
You need to create a placeholder.txt file in each empty directory if you want the precompilation tool to generate these empty folders. Failing that you can create a command line app that will create the folders in your post build events (but only if you are using web application project not web site project).
From my experience VS won't publish an empty folder. As a workaround we always put a dummy file in the folder to ensure that it gets copied over. Something like "placeholder.txt"

How to create a solution file using vs 2008

I have all the files for the deployment listed below :
-BIN
-CSS
-IMAGES
default.aspx
PrecompiledApp.xml
Web.xml
The above files can be copy pasted in the webapps folder and default.aspx could be run from the browser.
i want to create a solution sln file from this. How to create a solution file?
A solution is merely a container of projects. If you create a project containing these files, the solution file will be created automatically in the same directory (unless you specify otherwise).
File -> New Project
Expand Other Project Types, Select
Visual Studio Solutions
Under Templates, ensure you have
selected Blank Solution
Enter a name and a location for the
solution and click OK
File -> Add -> Existing Web Site
Select the folder that contains your
website and click Open
It looks as though you are creating a web site. I've never been able to create a solution with just a website in it (a web application is a different beast however). However, I have found a workaround, although it's a little cludgy. Create a new class library project (any project type will do really). This will create the project file. Then File -> Add -> Exisiting Web Site. Point to your existing web site and add it. This will create the solution file as you now have two items. You can now delete the first project that you created. This will leave you with a solution file with one web site in it.

Source control strategy for specific folders within CMS-generated site

I have an ASP.NET website where most of the pages are generated and published via a CMS system. This includes static HTML, CSS, ASPX, ASP, images, etc.
However, we have some user controls and pages that are managed by a separate dev team. These files live under the same web root but are not managed in the CMS. These files are limited to a few files and folders under the web root:
/bin
/user-controls
/custom-aspx
/web.config
(everything else under "/" is CMS-generated)
We don't want to check in all the CMS-generated items into source control (TFS in our case), because those files are constantly changing and versioning is managed within the CMS.
How should we handle source control for the directories listed above? Should we just check those in separately?
I see 3 options:
Checkout your version controlled file tree to root and add an ignore parameter for all CMS generated files (assuming they have a set of extensions that make this feasible).
Checkout each of the directories (/bin, /user-control, ...) separately to sub-directories of root, and make sure that no CMS generated files are written to these directories.
Checkout your version controlled file tree to root and just don't run svn add on any of the CMS generated media.

Resources