Visual Studio 2012 saying 'Unable to edit' when including remote CSS file - visual-studio

I have included the CDN of the bootstrap CSS in my project. Everything works absolutely fine, except when I type
<div class="
Then Visual Studio pops up an error saying:
Unable to edit
'http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css'.
here`The style sheet must be part of the current project and the project must be a Web Site or Web Application project
I can hit OK to dismiss these errors, and then everything works fine as well - it reads the CSS classes and populates Intellisense and works correctly when I build. But why is Visual Studio trying to edit the remote CSS file? How can I tell it not to?

I was having the same problem and a little search brought me to the following page:
http://forums.asp.net/t/1586914.aspx?Unable+to+edit+CSS+file+
In a nutshell: Add a fake parameter to the end of your CDN URL to get rid of your errors. This also makes intellisense work correctly.
Example:
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css?parameter=1" rel="stylesheet">

Related

Polymer won't render on IIS server

I made an empty project in vs 2015 with a basic component, but can't get it to work using IIS, I always get a blank page.
I am NOT using bower since I don't like it . I used vs's NPM to import all the files.
So, here is my setup in an image.
in my IIS I just right clicked the folder and set -> Convert to application, used the default integrated app pool as usual, and in the project I set it to use my IIS. The links works fine, if I type some text in the body it works.
What could be wrong?
I believe you will have issues with your structure. Most elements try to load Polymer in a link tag at the top of the component definition file ( tag-name.html) . Polymer expects every component to be within its own directory, as well as having the same parent. That being said, you could alter every file to look in the right location after downloading them all, or place all components, and the polymer library itself, into their own folders. A brief example:
App/
Scripts/
Polymer/
CustomComponent/
paper-material/ <-- downloaded paper component
This should allow you to not get 404s and multiple downloads of identical files.
The next issue is that you are using the Polymer 1.0 library but implementing it in the 0.5 API. Translating your element to 1.0 (including the conversion of elements into folders) would result in the following:
<link rel="import" href="../polymer/polymer.html">
<dom-module id="ad-nav" noscript>
<template>
<h1>Test</h1>
<template>
</dom-module>
This should straighten everything out.
I think the problem is you clicked "Convert to Application" in IIS. For regular HTML and JavaScript you do not need to click that option. Don't do that and it will work. Clicking "Convert to Application" in IIS assumes you want a .Net Application, not a plain JavaScript and HTML application. This changes file and folder permissions which caused your issue.

js and css filename being corrupted on publish with VS2013

I am publishing my Web App using the VS2013 publish mechanism. For some reason it has just started corrupting the js and css filenames. e.g.
From
<link href="/Content/bootstrap.css" rel="stylesheet"/>
To
<link href="/Content/css?v=puREEettBuwGkRK7y27hOQwXg4qvcAYRnG8wxc0gvnU1" rel="stylesheet"/>
This is only happening on publish to the live site. It works fine on publish to the localhost site. It looks like possibly some kind of versioning.
The defined bundles in BundleConfig are not being expanded, instead parsed with the above result.
Any ideas? I have not seen it before and its not showing up on Google searches. Thanks for any suggestions.
ANSWER:
For anyone else getting this problem - Once I realised it was the Bundles I found this which gave a lots of thoughts. However my specific issue was that I had installed Select2 via NuGet which had added a css directory in Content. As I was creating a Bundle pointing at Content\css these clashed. I removed the css directory and republished. Still didn't work. But when I removed that directory on the server manually it all started working again.

Why do i not have access to Content folder in MVC3 app under IIS7.5?

I have a fresh File -> New Project MVC3 application. When i Publish it and run it in IIS7.5 everything in the Contents folder seems to be inaccessible. Every other folder seems to work fine.
<img src="#Url.Content("/Content/1.png")"/>
<img src="#Url.Content("/Scripts/1.png")"/>
With this code Sample the top image is missing but the bottom one displays fine.
I have tried it in IIS express and everything works fine. Everything works fine when i start debugging the Site in IIS from Visual Studio.
It doesn´t seem to be an file access problem since the whole app folder has permissions for the IIS app pool and accessing content in the Scripts folder works.
Thanks for any help you can give.
You forgot the '~' (the app root path)
<img src="#Url.Content("~/Content/1.png")"/>
<img src="#Url.Content("~/Scripts/1.png")"/>

MVC3 Intranet Application / IIS Express Not Reading Site.css

I first created an MVC3 Intranet web application in Visual Studio 2010 Professional.
It worked just fine.
I then right-clicked on the application and chose "Use IIS Express..."
I also edited the application properties and disabled Anonymous Authentication but enabled Windows Authentication.
Nothing more. This is a bare-bones, default skeleton of an application that I want to start from.
Now when I run, I first get a pop-up window to login with my username and password. This is just as I expect. However, when I log in, the "Home" and "About" pages are not formatted correctly. It looks like IIS Express isn't reading my Site.css file.
How do I fix this?
Thanks,
- Paul
The default links for the style sheets typically use the ../../ directory navigation. When you're on a real webserver, those links typically fail 'cause now you're in a different folder setup. An easy way to correct them is to use:
<link href="<%: Url.Content("~/Content/style.css") %>"
rel="stylesheet" type="text/css" />
The url.content part will rebase the links to the current directory and will link up it's content correctly.
Hope this helps some, and good luck on your project.

Problem with Outlook plugin and webbrowser

I've created a couple of Office plugins. The plugin shows a set of html files installed on the clients computer. The plugin uses a COM-accessible assembly which shows a WinForm with a WebBrowser on it. The plugin makes the WebBrowser navigate to a file on the clients computer. The assembly is also used in other programs to show the same information.
When showing the local html files using a 'normal' browser (e.g. double clicking a file in Windows Explorer) the browser popup a security warning about running active content. This is because we have some javascript in it. This warning is supressed by setting the 'Allow active content to run in files on My Computer' in the Internet Explorer settings. This solves the issue using a 'normal' browser.
Funny enough the 'active content' warning is not shown when getting the same file using a Word/Excel/PowerPoint plugin. It calls the same assembly, using the same WinForm and using the same content. Despite the setting 'Allow active content to run from My Computer' being false, the content is shown without a warning and the javascript is executed.
Now, the problem and the real question is that Outlook does the reverse. No matter what I use for 'Allow active content to run from My Computer' the browser warning about the active content in the html file is shown. When I confirm the message and allow the scripts to continue, the javascript runs fine. So, even when I set the 'Allow active content to run from My Computer' to true, the warning is given.
I've gone through all (sort of) relevant settings in Outlook, but nothing helps.
I assume that Outlook is using some kind of private context for a webbrowser (probably because it is using a webbrowser object internally).
The real question is: how can I make the Outlook plugin respect the IE settings?
(I understand this is a long story and maybe not clear enough. Please let me know if I have to elaborate more).
I couldn't get rid of the security warning without lowering the security setting. And that is not an option: we are talking about a project that will be installed on millions of computers.
I decided to go another route. Let's see if we can make the browser trust the html pages. So, what to do to get rid of the 'Active content' warning.
First I investigated what exactly triggers the warning. That was easy: any tag in your html file will do. And I need script, so removing that isn't an option. But, when hosted from a website, the scripts run fine and don't suffer from a warning. So, I investigated if it is possible to run my files in the Internet-context.
I found out there is a way, at least for IE (which in my case is sufficient). If you save a webpage as a complete HTML file from IE, the browser adds a comment to the html to signal its origin. Something like: . If you later open that stored html file, the file is shown in the Internet context.
So, I tried adding to the html file. And, voila, the file is opened in the Internet context. The security warning about active content is gone and the scripts are executed fine.
But, that raised another problem. We have a couple of window.open statements in the scripts and using that causes he cross domain browsing problems that in recent IE versions are blocked. Even if you use a relative path in the window.open call, if fails and you end up with a blank window.
In our case, we can (probably) decide to get rid of the window.open calls. But, if a reader ever finds a solution for using window.open in this scenario, I would be very happy if you let me know.
So, for now: case closed...
Internet explorer use Mark of web in such cases
<!-- saved from url=(0014)about:internet -->
<!doctype html>
<!-- saved from url=(0023)http://www.contoso.com/ -->
<html>
<head>
<title>A Mark of the Web Example.</title>
</head>
<body>
<p>Hello, World</p>
</body>
</html>
More info from here
https://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx

Resources