Asp.net website compatibility with IE 11 - asp.net

I have an old asp.net intranet website.. I have been using IE 8 till now without any issue. Now I am trying to check if it works well with IE 11. I see that there is no problem with the site when requesting the page from IE 11 from my desktop.
But when I try to debug the same website locally in VS the controls are out of place and even fails to detect the IE Browser by
if(window.ActiveObject) which seems to be correct behaviour for IE 11.
Now I am wondering how the intranet website looks perfectly fine in IE 11. The server is Windows server 2008 IIS 7.
Any suggestion.

The window.ActiveXObject property is hidden from the DOM starting from IE11 so, you can no longer use it.
http://msdn.microsoft.com/en-us/library/ie/dn423948%28v=vs.85%29.aspx
In VS, it happens often to see the markup misaligned whenever in designer mode. But I think you should care less about that and focus more on the code markup instead

In the web config file you can use the customHeaders tag:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<httpRedirect enabled="false" />
<httpProtocol>
<customHeaders>
<remove name="X-UA-Compatible" />
<add name="X-UA-Compatible" value="IE=EmulateIE7" />
</customHeaders>
</httpProtocol>

Related

ASP.NET Ajax Toolkit Slider handle displays broken image

Using ASP.NET 4.5 Web Forms project that has been running for years and a new problem arose: the ASP.NET Ajax Control Toolkit Slider stop rendering an image (its a broken image symbol where the "handle" usually renders).
This only happens in IE11. Its working OK in Chrome nor Firefox (below):
Currently reviewing recent changes to code made (we've been doing an annual security review on OWASP Top 10) to see what may have broken it, but any advice appreciated.
Edit: recently we have been adding entries to our web.config customHeaders section per https://scotthelme.co.uk/hardening-your-http-response-headers
When we set X-Content-Type-Options=nosniff in web.config as below:
</system.webServer>
...
<httpProtocol>
<customHeaders>
<add name="X-Content-Type-Options" value="nosniff" />
</customHeaders>
</httpProtocol>
</system.webServer>
the slider breaks in E11. When the above is removed, the slider works in IE11.
I don't fully understand why, but this appears to be our culprit.

external page and iframe issue

I have 2 websites hosted on windows server 2012. One website is using asp.net while other is wordpress. I want to embed asp.net page in wordpress. But, it is not showing anything. I did some research and came to know that perhaps, I have to allow permission for external website. Please guide me how to do it, should I add anything in web.config? I added below in asp.net but it did not help
<head>
<meta http-equiv="X-Frame-Options" content="allow">
</head>
Please guide, how to allow external website in iframe?
The iframe looks like below:
[iframe mydomain.com/signIn.aspx 640px 400px]
Thanks
You can do it in your web.config (if hosted on IIS 7.0 or later):
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Frame-Options" /> <!-- optional -->
<add name="X-Frame-Options" value="ALLOW" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
This must be added in the application being "framed" (in your case an asp.net app), not in the parent app (wordpress).
Reference: https://www.iis.net/configreference/system.webserver/httpprotocol

Internet Explorer compatibility mode

I have a ASP.NET web application which is supposed to work on IE.
If I go to compatibility View Settings and uncheck Display intranet sites in Compatibility View and the domain is not added in the box Websites you've added in Compatibility View, the users sees the code not the forms of the page.
If I check the checkbox, he still sees the code, only after I add it in the box I can see the actual forms of the page.
I tried
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=IE5" />
</customHeaders>
</httpProtocol>
</system.webServer>
but still the same problem.
Is there another way to force it from code? I understand in the future the checkbox will be disabled so I must find I way to force the compatibility mode.
Can I add it to the box for Compatiblity View from code?

ASP.NET not showing CSS or JS works in VS2013 but not in IIS 7.5

Okay literally have spent 14 hours trying to get this to work today. I have a asp.net web app in VB that was built with Visual Studio 2013 Ultimate -- Everything works fine on localhost -- when I push to remote server the css styles and js don't load. I pushed site to a deb box I have running iis 6 and everything works fine. So I know issue isn't in code. and I'm not an IIS pro so any help or pointers in the right direction would be appreciated.
Okay after several hours I have found the answer.
When ASP.net is installed serve static content is not enabled by default
To turn this on, go to Start | Control Panel | Programs and Features | Turn Windows Features On or Off | Internet Information Services | World Wide Web Services | Common Http Features and check the Static Content box.
This can also be done via web.config file like so
<handlers>
<clear />
<add
name="StaticFile"
path="*" verb="*"
modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
resourceType="Either"
requireAccess="Read" />
</handlers>
<staticContent>
<mimeMap fileExtension=".*" mimeType="application/octet-stream" />
</staticContent>
I hope this helps anyone else that is having the same issue

Setting headers to override IE intranet compatibility mode in ASP.NET

I have an intranet site that loads in IE7 compatibility mode, unless the user has unchecked "Display intranet sites in Compatibility View" on their version of IE8. Unfortunately, the client wants this checked for other sites that they use, so I need to override this setting. I've tried the meta tag,
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
but it does not override the browser setting. However, this question indicates that a server heading will indeed override. This is the example code given in the top answer:
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
I've opened up web.config and put it in <system.webServer> but it doesn't work. I'm watching the headers with fiddler but it isn't adding the header at all. (Also, it still is forced to compatibility mode and Javascript confirms documentMode is 7.) I'm working locally with the ASP.NET Development Server
The <system.webServer> tag is specifically for IIS (7, I believe). It won't affect the Cassini server that Visual Studio uses in-house. If you only need to worry about this issue in a live dev environment, try testing on an instance of IIS. Otherwise, you may want to try IIS Express in development.

Resources