ASP classic: String encoding - character-encoding

I encountered a really strange error yesterday when I refactored the start page of a old ASP classic web application.
But before I explain the problem I must explain how the website is built.
The web itself is made of ASP pages saved as ANSI windows 1252. The output sent to the browser I guess is encoded as codepage 1252, because no encoding is declared neither in the response header nor in the HTML HEAD tag.
The Problem:
When I refactored the login page (due to security issues) I did the following:
converted the ASP-file to utf-8
Added <%# Language="VBScript" #CODEPAGE=65001 %> to the top of the page
Added <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> to the HTML HEAD
The login page displayed nicely. But! The rest of the website now got encoding issues (when displayed on a web browser) on all pages (except the login page of course).
How can that be? I didnt change any other pages, and the encoding settings made in the login page should only affect that single page.
Please enlighten me. Please! :-)

Because the codepage is stored in the session and it is changing on the login page. If you clear cookies or open an incognito browser, the problem should go away until you return to the login page again.

Related

Display Differences when loading local HTML Page

I have come across an issue when I add a TWebBrowser to a Delphi form and then load a webpage either from file, i.e. wb1.Navigate('file://myhtml.html'); or navigate to the exact page stored on a website, i.e. wb1.navigate('http://mysite/myhtml.html');
It seems to process the CSS differently whether I load the page locally or from the website in IE itself!
I have made sure the page has <!DOCTYPE html> which is meant to force IE9 as a minimum from what I have read.
Anyone seen anything like this before?
This is what it looks like if I load the page using TWebBrowser:
In IE, it displays the data correctly side by side horizontally.
Thanks. It was the compatibility mode that was the issue.

Using WebMatrix and Razor

I am using WebMatrix to edit my web page. After clicking on the Run button, I can see the time being displayed, but when launching the page from the desktop I see the source code [#m_date.ToString()].
--snip--
#{var m_date = DateTime.Now; }
<!DOCTYPE html>
<head>
....
</head>
<body>
...
<p style="text-align: center">#m_date.ToString()</p>
...
</body
What am I doing wrong?
Thanks in advance.
Razor is a server-side technology. This means that your page needs to be processed by a server. This server turns the mix of html and razor code, into plain Html. This Html can then be rendered by your browser.
When you open a .cshtml directly in your browser, the razor code is not processed, and is displayed as the contents.
Webmatrix uses a server (IIS express most probably in your case) to launch your page. When you hit run it starts your browser and you go to url like localhost:12345 with the rendered (already processed) page.
If you have saved this page to your desktop it will be either html or cshtml depending on how you saved it. Then clicking on it does not process it, but rather you ask the browser to show the contents.
Here is an intro to Webmatrix to understand how it works and what it does when you do trivial things like this one.

JSP Page Cache in Internet Explorer

In one of my Jquery plugin application, I have one window which opens a JSP page displays rows from database.
In Internet Explorer, except when I run application after I start for first time, all the time this page doesn't display all the rows from database till I Clear Cache in Fiddler plugin. After doing this, all rows are displayed properly and after some this problem happens again.
In this JSP page I have the following but it doesn't help.
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
There is a call to servlet, however doGet method is not called from JSP.
How can I resolve this issue? This problem happens only in Internet Explorer
You can try instead of doing it in HTML markup, do it in JSP:
response.setHeader("Cache-Control", "no-cache");
Try other methods like:
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
And if this is just a problem for you as a user, make sure to set IE to pull a new version of the page "Every Visit to the Page" rather than the default setting of "Automatic" which doesn't work very well. (In IE8, Tools->Internet Options->Browsing history section, Settings button.)
Also when calling a page via Ajax or opening a window with Javascript you can add an extra parameter to the URL that is just a timestamp or random number to trick IE into dealing with the request as a new one.

How to force to open a Page in Document Mode as IE8

We have deployed our webapp, which was developed with JSF, Spring and Hibernate on Tomcat server in our internal network (intranet). When I test in my application in local it's working fine.
But once I deploy to DEV I come across style issues. When I have two dropdowns one after another, the top dropdown overlaps with another one.
This happens when I have Document Mode set to "IE7 standards." When I change Document Mode to "IE8 standards," everything works fine.
To force Document Mode to IE8 standards, I tried this meta tag in my section of the HTML document according to this link, but it didn't work for me:
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
How can I force my page to render according to IE8 standards on the intranet? Does my application render in IE8 standards on the internet?
EDIT :I see something in my develoer tools.Even though I kept my <meta> it after <head> but my primefaces styles and scripts are loading before to that.How can I resolve this?
Odd, this item was posted yesterday, not sure if it applies to your situation:
IE 8 will ignore the x-ua-compatible setting if it comes after the stylesheets. In order for IE to acknowledge the meta setting, put it at the top.
I am glad to tell I am finally able to resolve this issue by using this link in primefaces.And this post also helped to do it through entire application
http://blog.primefaces.org/?p=1433

External stylesheet content gets included on page somehow

I've run into a weird issue with a site running ASP.NET MVC on IIS7.
Whenever I do a page refresh (F5), the external stylesheet content gets "injected" into the page itself, instead of the tag pointing to the css file. Example:
<head><link type="text/css" rel="stylesheet" href="external.css" /></head>
Renders as:
<head><style type="text/css">body{ color: #000; }</style></head>
Locally, there is no issue at all, only when it is uploaded to the server.
If I do a hard refresh (Ctrl + F5), it renders as it should, but subsequent requests will not.
I'm inexperienced with IIS7, so I don't know if this issue could be caused by it.
Any help would be appreciated.
Turns out an improperly closed script tag was wrecking havoc with the page.
After fixing it the page renders normally.
Well, this is a weird issue. I don't know if IIS7 has a setting, or a handler that would cause this.
Try using a tool like Fiddler or Live HTTP Headers to verify the external CSS file is actually not being requested at all.

Resources