Question marks in ASP pages - iis

I am currently migrating a website from IIS6 to IIS7.5. I have a classic ASP file encoded in ANSI (according to Notepad++) which connects to a database and retrieves data with characters outside the ANSI range (Gaelic characters) and displays them on the page. When I then view the page in my browser, the Gaelic characters are displayed as question marks. I can change the encoding of the ASP file to UTF-8 and the Gaelic characters are displayed fine.
The problem is I have tens of thousands of ASP pages which I would need to convert to UTF-8 which, at the moment, isn't an option to apply the conversion.
Is there any way I can configure my web server (IIS7.5) to read the ASP file as UTF-8?
Is there an alternative solution to converting all the pages to UTF-8?
These pages work fine on IIS6 for some reason.

I have just stumbled upon the answer.
Open IIS manager
Select either the server or website node
Make sure you are in Features View
Open the ASP settings
There should be a setting called Code Page. Set this to the value 65001
Click Apply in the actions pane on the right

I had this exact problem, too - the Hebrew being output by my MySQL database was rendering in the browser as ??????????, for example. (I created a classic ASP app, the output of which is in Hebrew.)
I tried everything and NOTHING worked.
Then I realized I was using the wrong (ANSI) ODBC connector. You have to use the Unicode one, at least if your data is coming from a MySQL database.
So, your connection string would contain this:
DRIVER={MySQL ODBC 5.3 Unicode Driver};
and not this:
DRIVER={MySQL ODBC 5.3 ANSI Driver};
Now, it displays perfectly. I sincerely hope this helps some folks!

Related

Opening a read only URL with password

New to Web site dev, though have done a lot of coding of other sorts in the past, just set up a personal blog for my own amusement on bluehost using wordpress and have it installed locally for dev.
I have a training log on another site which anyone can open read-only to view training stats with a URL of the form below, this works fine in a browser:
https://www.othersite.com/logs/1234xyz/authenticate?password=thisismypassword
What I have tried to do unsuccessfully is have this open in a frame on one of my web pages (used iframe/object in html). It seems impossible to do this as the authentication string is not passed across, and the screen displayed prompts for manual input of the password. Can I open this automatically in some way?
If I understood well, your solution is insecure regardless it works or not. In this way your clients can see the password of your (or another) site.
I suggest to query the external content using custom php code and display (print) it on your page.
There are several ways to get content of an external page:
https://www.php.net/manual/en/function.stream-context-create.php
https://www.php.net/manual/en/function.curl-init.php
If you need a tutorial for WP plugins check this out:
https://www.wpbeginner.com/wp-tutorials/how-to-create-a-wordpress-plugin/

HTML encoded text accessed by multiple systems

We have multiple systems interacting with each other. There is a public facing website where customers enter text. There is a webservice that enters the text into a CRM database. As a good practice the text is being HTML encoded before forwarding it to the webservice. We have two applications reading this text one is a web application where we have code for HTML decoding. Another is a third party CRM which does not have the decoding code as a result of which it is displaying the HTML characters to the user.
I am trying to find a solution to prevent users from viewing the HTML characters. CRM is a third party application and in production so everyone is reluctant to make any changes to the CRM.
Is there any other solution? One proposal is to decode the text before entering it to the CRM database. Is this a good solution or are there any other.
In most environments, as the number of distinct systems increase you are increasing less likely to have a single integration point. As a result, you will have to build gateways specific to each of the integrated systems which handle the peculiarities of each of these external systems. So, build a gateway for your CRM system which decodes the HTML from your system of record as it sends the data to the CRM (as well as other peculiarities your CRM requires...).
As a good practice the text is being HTML encoded before forwarding it to the webservice.
This is not really good practise, and this should only be done if the user is actually entering HTML via a control on your site such as a rich text editor. OWASP Guidelines recommend only output encoding which is context specific (e.g. HTML required a different set of encoding rules than JavaScript).
One is a web application where we have code for HTML decoding
Isn't the web site simply displaying the encoded text and the browser is doing the decoding? It sounds to me like your CRM system is HTML encoding the already HTML encoded data (as it should), which is why you are seeing encoded characters.
e.g. User enterers & which you store as &. Your website displays this as & which is decoded by the browser as &, the CRM system displays this as & which is decoded as the browser as &.
What you should be doing
Do not HTML encode your data when storing - it should be stored in plain text. If your system is already live you will need to run a batch process to convert the HTML encoded data into plain.
Fix your site to HTML encode the data it receives from the web service when output to users. So & stored will become &. This will mean your site and CRM systems are both correctly encoding the plain text data, and since they are doing it exactly the same way there will be no display issues.

Browsing to PDF causes the PDF to be downloaded instead of displayed

I have two servers with virtually identical setups (the second that is working has been around longer than the other). For my newer server when I just put an address to a PDF in the browser it launches a download dialog. If I put the same address (just changing the server name) in the browser to my older server it displays in the browser just fine. There is no difference between the files themselves. The issue is I want to display these pdfs in an iframe on a page and the same thing is happening with the iframe (the new server launches a download instead of the pdf just showing in the frame).
Any ideas would be most appreciated!
Once I started looking into SP 2010 as being the cause I found that there is a default setting for all new 2010 sites that causes this issue. The following blog post had the most complete information on the subject:
http://nerdtastictips.blogspot.com/2010/08/sp2010-forces-users-to-save-pdfs.html
Please indicate web server your are using
Initial suggestion may be this has to do with MIME-TYPE setup

Is there a website level setting in IIS that would prevent an ASP page from being served?

Trying to copy a website to a new server as the old one is dying. :(
I tried copying over the files and setting it up manually, but some specific user accounts needed to be used and the guy who set all this up left the company nearly 5 years ago. And is even worse at documentation than I am.
Anyway, at that point the ASP pages were serving, but getting errors. Ok, fine... I went back and exported the configuration from the old server (lucky that worked at all) and created a new website from that config on the new server. On the new website, from the config file, the ASP pages are giving 404 errors.
The Active Server Pages extension is enabled, and I can actually get the asp pages to serve from another website on the server... so I'm thinking it's something at the website level. No idea what though.
Any ideas?
Back when I was doing classic ASP development we used Parent Paths. This is at the top of your ASP file you'll see something like;
<!--#include file="../../resource/includes/MSSQLconnection.asp"-->
This isn't enabled by default in IIS. It may not be answer but worth looking at. But was a long time ago now.
Hope this helps,
Mike
404 is a file not found error.
Start by checking you can access a 'hello world' HTML file in the folder using http: //localhost/path/toyour/HelloWorldFile.htm
Hello World
is all you need in the file = you don't need to bother with any HTML markup to test what we're interested in.
This will check that your virtual directories, application settings etc are correct before you move on to the Active Server Page settings.
Once you've got your paths sorted out and you know you are looking for your application in the correct place move on to a 'hello world' ASP file
<%="Hello World"%>
is all you need in that file!
You ask about settings in IIS which will stop ASP from working. These come to mind as the most obvious.
Depending on the OS (or more specifically the IIS version) you may also need to activate ASP pages.
These instructions from msdn cover Windows 2003 (IIS6) and Windows 2008(IIS 7.x)
If you can get your hello world script working you can move on to debugging your application.
It will be a great help when debugging the application if you can see what's going wrong so I recommend that you turn off friendly error messages if you are using Internet Explorer. Also set IIS to pass error messages on to the browser
see:
http: //learn.iis.net/page.aspx/564/classic-asp-script-error-messages-no-longer-shown-in-web-browser-by-default/ --excuse the link formatting but SO's newbies can't post more than 2 hyperlinks in a message was getting in the way of me trying to be helpful and earning enough rep to post more!
(that may only be relevant to IIS 7.x I don't have an IIS6 installation lying around to refresh my memory.
Make sure you are browsing your application on the server using http: //localhost - this should ensure you see any errors
Good luck

What quirks are in the Blackberry Web Browser that a developer should be aware of?

Before I start pulling my hair out on any "known issues", is there any quirks or problems that I should be aware of.
Specifically with cookies, JavaScript, HTML, CSS and images.
PS I have a copy of the docs provided by RIM, but I'm hoping others know of some lesser known issues.
Here are a few that I've noticed:
For some reason, the BB browser doesn't seem to handle underscores in the hostname correctly. I don't remember what happened, but if you hostname is like this: http://some_host/blah, I remember it having problems.
This can be corrected with a DNS entry that removes the _
Another thing we've seen is serving up .jad files for Java downloads. If your module contains _ or other special characters, the BB browser displays a HTTP 500 error when trying to fetch the .jar or parse the .jad. This is especially annoying because it's not actually an HTTP error, the server is serving up a file, but the BB browser just can't parse it, so it blames the server.
We fixed this by using Fiddler to hit the .jad URL and view the contents of the HTTP response. If your .jad has any special characters (or sometimes URL/HTTP encoded strings) you might need to simplify your module name to only use A-Za-z0-9
I know those aren't exactly html/css things, but thought I'd post this anyway!
I had used the blackberry browsers on emulator versions to test my web pages.
These are some i would like to point out.
Please forgive me in case of any deviation with a real case because these are specific to emulator versions on windows 7 OS. I dint have the devices to check and verify.
When we are coming down to a BB OS version below 5.X (eg. BB 9630), the browsers support for java script will be turned off by default. So you need to go browser options turn on it manually.
When we go further down to BB OS version 4.2, the style sheet support will be turned off by default. Causing your webpages to render without applying style sheet. So that time you need both the java script and style sheet supports to be turned on manually.
Even when i was on a OS version 7.X or 6.X, the internet connection was working and i could connect to pages. When i went down to version 5, those emulator browsers shown issues for connection. On googling i found that MDS is a requirement when we go down the versions and seek internet access.
I installed MDS, still it was not working for versions below 6, reason being the JAVA_HOME environment variable was not set in my advanced system settings in my-computer properties. But it was not even pointing out the issue and the MDS was closing instantly.
So after setting my JAVA_HOME to "C:\Program Files (x86)\Java\jre1.6.0_07" the place i installed JDK(we need JDK for MDS), internet connection started working.
Also if you are using g zip compression for your pages, below Blackberry OS version 6, the browsers no longer requests for a compressed one. (found it on OS version 5 emulators BB 9700,BB 8520).
Also when you are going to use a css property or html entity that you doubt support, be sure to go to the corresponding OS version content developer guide and find from which version are they providing the full support and partial support.
Check out the BlackBerry Browser Version 4.2 Content Developer Guide. It is for the older 4.2 browser but still has lots of good info about what HTML, CSS, and javascript is supported.
My experience with BB 8700 is that you should not use JavaScript, neither depend on CSS to be rendered correctly. It also has no flash player by default so you're off to plain server-side HTML form processing/ASP/CGI. Also beware of size, as internet can get pretty slow while on the road.
One known issue is that the Blackberry browser completely ignores the css display property, so you can't use display:none to hide content.
We've also had trouble with basic form submittal - sometimes, the POST doesn't happen at all, other times it happens but some or all of the form fields go AWOL. We haven't been able to get to the bottom of this issue, but it seems to occur mostly with the BB Curve series.

Resources