Why did my css not work until added to project? - asp.net

I have an asp.net mvc project, and I replaced the default css the wizard built with the iui css and javascript package. They were placed in ~/Content/iui/ folder. When i ran the site through the dev web server, the css didnt get used. I managed to fix it by adding the iui folder to the project in the project explorer. That's all I did, the pages already the script and style tags set up properly.
What is going on here? I'm sure MSVS is up to something behind the scenes, and I'd like to understand why it did this and why what I did produced the behaviour that it did.

Look in the "property pages" for your website project (VS Menu: Website -> Startup Options). Under "MSBuild Options", the "output folder" setting is the path that the Visual Studio Dev Web Server uses when you run it. Only files that are part of the project get copied to this directory.
This is the reason why even though, you added the files to correct folder, it was not the one that the Dev Web Server was looking at.

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.

Can I use dev tools persist with live site?

Trying to use Dev Tools Persist. Had a lot of trouble adding folder but eventually that worked. Folder is faded out and I can't "Map to File System Resource" (right click only shows this:
I tried using the "show editor in console" experiment (here and here) as a workaround but could never find it, despite enabling experiments.
I'm using dev off the live site. I don't control the site so don't have access to local files. I only need to update styles.
thanks!
Had the same problem, missing "Map to File System Resource". When my source maps included sourcesContent, the file mappings were automatically made and I could live edit my scss. Apparently chrome uses the content to find the right file.
node-sass --source-map-contents

Bootstrap Controller not working in

bootstrap controls are not working after hosting website in IIS. Is there any solution for solving this problem. This project is completely done.
Check iis have permission to access folder contains bootstrap. You can do this by
Open your site in Chrome
Setting-> More options -> View source
Click on "Bootstrap" link.
This problem may cause on some hosts if folder name contains .(dot), like bootstrap-3.1.1

ASP Site - Updating Dlls on Change

When I make a change to the a aspx.cs page in my website and then build I notice that none of the dlls in the Bin folder are updated, the only dlls I can see in there are the references the web app uses. I want to bring across this one change rather than redeploy the whole site so where are the changes being saved?
I've tried various things like build solution, rebuild solution, build website, rebuild web site.
Is it possible my dll is being sent elsewhere? How would I go about finding out where?
In Solution Explorer, on root project node, right-click and select Properties. Click on the "Build" tab and look under "Output" section. Here you will see the actual output path and can change it to your bin folder.
In Solution Explorer, on root project node, right-click and try to Clean solution and then again build whole solution.

Why doesnt my img show up in ASP.NET

I created a C# web project with MSVS 9 and thats all i know about my configurations.
In my browser i can access any aspx files i have in my project. However when i use http://localhost:3288/img/test.png i see nothing. The working directory is ./root, the png file is in ./root/img/test.png How do i have ASP.NET display my images and everything else in the folder? (and subfolders).
Is the .png included in the solution?
When you hit the "play" button your essentially starting up a new website ( localhost:2383 ) so if its not in the solution it won't be copied over to the new, temporary, website that the debugger attaches too.
If this is the problem a quick fix is to hit the "Show all Files" button on the top of your solution explorer, this will show all the files in that folder on your hard drive. Then right click on the .png you want to include and hit "Include in Project".
Based on your comment your only solution is to actually create an IIS site for your solution with the root dir the same as your web project. Then in the project properties you'll have to tell the debugger to attach to your local IIS instead of visual studios. Not sure the exact click path, right click on your project and go to properties, look for debugging options.
Give a look to the ASP Image control , you can specify paths starting in your app root (~):
<asp:Image id="Image1" runat="server"
ImageUrl="~/Images/image1.png"/>
Or you can use relative paths to the page that are displayed.
Check this article about ASP .NET Website Paths.

Resources