I'm working with two ASP.NET (.NET 4.5, IIS 10.0.17763.1) projects. Both are affected by this problem. There are dozens other projects built using the same technology that are working fine.
When debugging, "e" followed by precisely 2050 "�" symbols are inserted into the output html in seemingly random places. There doesn't seem to be any pattern to where they show up.
How it looks like when I hit "Inspect" in Chrome:
<img id="cphHomeBannerMe���������[...]����������ain_ScrollingBanner1_firstImage"
"View page source":
type="text/css" media="screen" /e [multiline blank space] ><link href=
When I copy the output of "View page source" into notepad, the blank space is removed but "e" remains. So, for the above example it would be
type="text/css" media="screen" /e><link href=
Needless to say, it completely breaks the page layout.
Launching without debugging (ctrl+f5) launches the project normally.
The project is version controlled using TFS and runs well on other PCs.
This is fixed by unchecking Enable Browser Link and reloading the page. The option should be under a menu that has a little refresh icon as it's image - next to the debug dropdown in your toolbar.
If you want to know more, see: https://devblogs.microsoft.com/aspnet/browser-link-feature-in-visual-studio-preview-2013
Related
I have disabled Browser Link inside Visual Studio 2022, and I have also disabled all the Hot Reload functionality.
Even the Browser Link Dashboard indicates it should be disabled:
I also do not use any of the app.UseBrowserLink(); code anywhere in my code. (as documented in Browser Link in ASP.NET Core.
However, these middlewares still somehow appear in the request pipeline:
Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware
Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware
These middlewares add this to my HTML:
<!-- Visual Studio Browser Link -->
<script type="text/javascript" src="https://localhost:44399/0928d478a97d441187231f2a1a7cd5e5/browserLink" async="async" id="__browserLink_initializationData" data-requestId="c94cf93088fb44e98f4e499b20ad7bfe" data-requestMappingFromServer="False"></script>
<!-- End Browser Link -->
<script src="/_framework/aspnetcore-browser-refresh.js"></script></body>
And every time I save a file, it reloads the browser. I want to stop this behaviour, and I ran out of options how.
Is this something that the IIS Express or Visual Studio add automatically?
I also checked all the packages and DLLs, and I don't see it included anywhere in my code. It must be included automatically via some "magic" that Visual Studio 2022 does.
How do I stop all this reloading? I do not want any Browser Link or Browser Refresh. Please help, I spent a lot of time on this, and I'm desperate.
You are almost there. You just need to also config the following (Don't forget to restart your VS):
Visual Studio uses .NET Core's Startup Hook feature to inject those middlewares, if you set a breakpoint on the first line of your Program.cs and evaluate System.Environment.GetEnvironmentVariable("DOTNET_STARTUP_HOOKS") in the debugger, you can see which hooks are getting loaded from where. If you now go and rename the files it's trying to load, it won't be able anymore to do that and you're free from browserLink!.
For example, in my case, it was loading
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\Web Tools\Browser Link\Microsoft.WebTools.BrowserLink.Net.dll"
"C:\Program Files\dotnet\sdk\6.0.201\DotnetTools\dotnet-watch\6.0.201-servicing.22124.17\tools\net6.0\any\middleware\Microsoft.AspNetCore.Watch.BrowserRefresh.dll"
so i renamed them, adding a _ in front of them which made the script injection disappear.
More needed to uncheck!
This is really hard to unroot feature.
2 days ago the Visual Studio worked perfect, but after the update I just can't work with it. The problem is that the Visual Studio does not apply my code in ASP.NET Web Forms, I see every time what I did one or two step back.
I tried to re-build the solution and it didn't work.
Any ideas?
I think your problem might be that you need to cache-bust your css file.
You can do this by adding a version number to your include (or using a variety of other methods: see https://css-tricks.com/strategies-for-cache-busting-css/ )
Let's have a look at manually providing a version number:
You need to provide/change a version number on your css file that you modified like so:
<link rel="stylesheet" href="style.css?v=2">
Notice the ?v=2 part.
Your browser will interpret that there's a new version of your css file and will fetch the new version.
(Keep in mind you'll have to do the same for javascript files.)
Hope this helps.
I think my problem is that I don't have Angular JS properly configured on my machine or Visual Studio 2015, but I'm not sure. All I know is that my app is showing a blank page and that Visual Studio 2015 is not recognizing Angular tags. Can someone explain what I'm missing and how to add it?
I have been given a Visual Studio solution from a client and need to get it running. I know it uses some kind of Angular JS and seems to be using C# 6.0 and needs Visual Studio 2015 to compile. I have never used VS2015, C#6.0, or Angular before. I usually develop asp.net/C# apps in VS2013.
The project compiles (I can clean and rebuild it), but the initial screen is blank. The page source of that page seems to be the code I want however. In VS, I can see it doesn't recognize certain tags. I thought that I needed to include a reference or download something related to Angular. I re-downloaded the Angular files from https://angularjs.org/. I also tried explicitly reference the angular.js file in the head of the aspx page as shown here: https://www.npmjs.com/package/angular-material. I also tried adding the angular to intellisense as described here: AngularJS intellisense not working on Visual Studio 2015. None of these are working.
In VS, I'm getting warnings on lines like these:
<body ng-cloak ng-controller="litm.xyz.recipes.IndexController">
<div layout="column" layout-fill>
<md-toolbar>
<md-button class="md-icon-button" aria-label="Settings" style="padding: 0">
The errors say that the attributes aren't part of the tag or that the tag is not supported:
I thought this was just intellisense not working, so I tried to run the solution. It compiled and shows me a blank screen. If I look at the page source of the screen, I can see that my code is there, but nothing is displaying:
If I remove the Angular tags, I can get the page to show up. So if I replace the initial body and div tags with this:
<body>
<div>Text
I can see part of the page:
This seems to indicate the problem is with the Angular tags. So how do I get them to work?
Edit 1:
I added these references to angular:
<script src="/lib/angular/angular.js"></script>
<script src="/scripts/angular-aria/angular-aria.js"></script>
<script src="/scripts/angular-animate/angular-animate.js"></script>
<script src="/scripts/angular-material/angular-material.js"></script>
The only place I could find angular in the code is in package.json:
"browser": {
"angular": "../lib/angular.js",
"angular-animate": "../node_modules/angular-animate/angular-animate.js",
"angular-aria": "../node_modules/angular-aria/angular-aria.js",
"angular-cookies": "../node_modules/angular-cookies/angular-cookies.js",
"angular-hammer": "../node_modules/angular-hammer/angular.hammer.js",
"angular-data-table": "../node_modules/angular-data-table/release/dataTable.helpers.js",
"angular-material": "../node_modules/angular-material/angular-material.js",
"angular-messages": "../node_modules/angular-messages/angular-messages.js",
"angular-sanitize": "../node_modules/angular-sanitize/angular-sanitize.js",
"angular-ui-grid": "../node_modules/angular-ui-grid/ui-grid.js",
"angular-ui-router": "../node_modules/angular-ui-router/release/angular-ui-router.js",
The angular js files are in the lib and Script folders:
I want to use a Web Browser to access a website that uses JavaScript on load. I understand that Web Browser is a wrapper of the current installed version of Internet Explorer. However, testing the website on Internet Explorer yields no errors but does not work if I use the Web Browser to access the content.
I have also looked at my internet security settings to ensure it is enabled.
The issue I get is;
Awkwardly enough, I found the answer moments after posting this but I thought anyone who comes across the same problem as me will find solace in this answer;
It seems downloading the latest version of Internet Explorer is not enough and you must explicitly specify the version of IE to use by adding a new registry key.
HTML fix;
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
... other headers
</head>
<body>
... content
</body>
</html>
Via registry;
Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION for 64-bit or 32-bit only machines.
Or go to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION for 32-bit on 64-bit systems (It cannot hurt to add keys to both locations if you have them. If you do not have them, you can make the folders yourself).
Create a new DWORD key and name it the name of your application e.g. "myapp.exe" and then edit the value of the key. There are many different values you can add depending on the IE version you want to emulate. I entered 11001 (as a decimal value - 0x2AF9 in HEX) which emulates IE 11 (many more values located at: http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation).
If you're using Visual Studio like I am, you'll notice that this method might not even work. However, it does work. You need to manually open the .exe file using Explorer or terminal rather than run the project on Visual Studio.
If you wish to run the program on Visual Studio then consider adding a key for "myapp.vshost.exe" as this is used for debugging.
More information and source is from; http://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version.
I hope this helps anyone with any issue regarding your Web Browser perhaps using the wrong IE version as a wrapper or functions are not working as intended.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
... other headers
</head>
<body>
... content
</body>
</html>
This will work out , This is the summery of Ryan Singh's answer
I have a C# .NET windows application that will get HTML files and use them to display data. The HTML files will have javascript in them to help parse/display the data, and one of them uses an activeXObject to display PDF files.
When I install a binary version of the windows application, the PDF file displays properly and is fine.
When I am running from DEBUG mode from VS2008, i get the error:
Failed to load details page. An
exception occurred in the script.
Error name: TypeError. Error message:
Object doesn't support this property
or method
They are both referring to the same HTML page, the only difference is one is a binary install and the other is just my DEBUG build running.
I need to get it working in DEBUG mode so I can test but I'm not sure what's wrong; Any suggestions would definitely be appreciated!
Edit: Sorry here is the HTML Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Received Fax Preview Page</title>
</head>
<body>
<object data="myfile.pdf" type="application/pdf" width="800" height="600">SUP</object>
</body>
</html>
And i'm just using the C# web browser to display it.
_webBrowser.DocumentText = htmlDoc;
Finally got it to work by switching to x86 platform in VS (from Any CPU) and building the project. I'm guessing since my machine is x64, in debug mode the application targets all x64 components and IE x64 can't load PDFs, but maybe in the binary (which is x64) it goes to the common IE x86 bit to open the PDF?
Not 100% sure the explanation, but it is working now.