How to isolate one page using "X-UA-Compatible" from Master Page - c#

I have an application with a master page. The page inherits the master page. Prior to IE9, we had no issues in regards to our image viewer. After some research, I have found that I need to use the "X-UA-Compatible" in the meta tag. However, this issue is only occurring on one page.
If I put <meta http-equiv="X-UA-Compatible" content="IE=8" /> in the master page, the problem is solved, but that means the rest of the application will have to use this as well. Is there a way for a single page to use that meta tag without effecting the rest of the application?
Thanks for any input.

There are many ways, e.g.:
put the Response.AppendHeader("X-UA-Compatible", "IE=8"); to the
codebehind of that single page
Put a placeholder to your masterpage and fill it with the meta tag only on that single page

Related

Image Included: Blazor sometimes loses its styling and navbar. I can't figure out why

Here's a link to what it looks like: https://imgur.com/a/MaEXaJr
This happens to me every once in awhile, and I can't figure out how to fix it. Even if delete the project, download the previously working version from GitHub, it still will do this.
If I am to create a new project, the problem is not there.
Ideas?
If you inspect the page the bootstrap link should be in the header portion above the navbar inside the _Host.cshtml. This is the layout of your application. I used the link provided and was able to render the page. Never place <script> tags inside the header... by standard these should go above the </body>.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
I would also add the script tags just above the </body> portion.
https://getbootstrap.com/docs/4.5/getting-started/introduction/

Timers from ASP.NET to MVC Razor

I'm moving an app from ASP.NET/C# to MVC and I have some Timers <asp:Timer>
I'm trying to find exactly the same tool for MVC (Html5 or DevExpress) but seems like there is not or at least my intellisense doesn't show it.
Anyone knows about it and can post the squema of it?
You will need to use Javascript yourself.
Take a look at window.setInterval() or one of the many jQuery timers.
Another option, that doesn't involve javascript is the HTML META tag.
example:
<meta http-equiv="refresh" content="30">
content is specified in seconds. META elements live within the HEAD element.

How to refresh just a specific portion of an HTML page?

I have one HTML file containing several <div> elements. I want to refresh just part of the page using either JavaScript or C#. Can someone help?
I am trying to do it this way:
document.location.reload(document.getElementById("contentdiv"));
It reloads the whole page. I wish to reload contentdiv. If contentdiv is at the middle of the page then it should load only that part.
Thank you.
You could move the contents of everything you want reloaded into an external file, and either use the <iframe> tag and only refresh that frame, or you could use JavaScript and refresh the div with Ajax.
Ajax isn't that simple to explain in a short answer, but you can find plenty of information on it here: http://www.w3schools.com/Ajax/ajax_example.asp or if you use a framework like jQuery ajax is much easier.
iFrames can be implemented (on mypage.html, for example) like so: <iframe src='mypagecontent.html'></iframe> and in mypagecontent.html you could use <script type='text/javascript'>window.location.reload();</script> to refresh the frame.
Not sure if this is what you're looking for, but hope it helps somewhat.
What ASP.NET Framework are you using? If you are using Web Forms, look into UpdatePanel

How should I handle multiple links ot the same page with different Query Strings

In the website I am working on, there is a product page with 8 tabs on it, showing different aspects of the product. There are quick links on other pages within the site that take you to the page and to a specific link specified by a query string.
For example the base page would be www.example.com/Product1. And then there are links like this:
www.example.com/Product1?tab=CADDrawing
www.example.com/Product1?tab=Schematics
www.example.com/Product1?tab=Reviews
My concern is that Google sees each of these links as a different URL but they aren't and the data on the page is 100% the same. Is there any easy way to make it so Google either knows that www.example.com/Product1 is the base page or doesn't follow the links with Query Strings?
I thought about using rel="nofollow" but that seems like it would actually hurt my page ranking. Most of the websites, including Googles on webmaster pages, is unclear.
The other option is to add the rel="canonical" to the pages that have a query string but not to the base page. Does that succeed in stopping all of the noisy links?
Using a link tag with a canonical URL in the head of the product page should do the trick:
<link rel="canonical" href="www.example.com/Product1" />
There is a base-tag in html:
<head>
<base>www.example.com/Product1</base>
</head>
Maybe that will indicate to google that its all the same page? This is just a wild assumption though, no idea how google will handle it.

Rendering "partial" pages in ASP.Net? (without the <html> and such)

I am trying to make use of jQueryUI AJAX tabs in my ASP.Net Webforms project.
I have come up against a wall though. For AJAX, you must render only a partial page(no <html> and such elements) by an external URL. How would you best do this in ASP.Net? aspx files require things like a <html> and <head> tag so those wouldn't work so the only thing that comes to mind is using cumbersome ashx files. Am I just over thinking this? Is there an easier way?
Edit:
So apparently <html> and such tags are not actually required. So what differences are there to rendering without the full page headers? Will some controls not work? Why wouldn't they?
There's no reason your .aspx pages have to have <html> tags.
Just go ahead and build .aspx pages with the content you want on them and point your jQuery UI tabs to each URL and it will wire up nicely.
ASP.Net does not require any particular HTML tags.
You can make a partial page as an ASPX that includes whatever you want. (Although some server-side controls might not work)
In fact, you can even make an ASPX page that renders aribtrary (non-XML) plain text.

Categories