Archive for category IIS

Helicon ISAPI Rewrite rules ignored – You must save the rewrite file with ANSI encoding- NOT UTF8!!

We recently had problems with Server Rewrite rules not working when uploading a new site.  The rules had worked fine locally, on dev, but when we uploaded it wasn't having any of it.  The rules were in the httpd.ini file which sat in the root of the site- the syntax of the rules was identical to other file's we had used on other sites.  After much head scratching Paul suggested it might be the encoding of the file- we opened it in Notepad and went to save as and changed the file from the default "UTF" to "ANSI" encoding and everything started working!

No Comments

Move from BlogEngine.net to WordPress 2.7.1!

I’m a .net developer by day, so am always keen to use .net technologies where ever possible.  For the past few months I’ve been persevering with BlogEngine.net, a dot net blogging platform which I run on my Windows 2k8 IIS7 box from home, however I can do it no more!  I’ve found myself looking on with envy at the features in the newer builds of WordPress as i struggle on with the various “quirks” of BlogEngine and finally decided I could no longer put up with it- I’ve made the switch to WordPress which I’ve used in the past and I have to say I’m pleasantly surprised- not only is it as good as i remember, but it’s come on leaps and bounds both feature and interface wise since I last used it.

To get WordPress up and running I had to setup PHP5, mySQL (and phpMyAdmin to save me the pain of mySQL command line syntax again) under IIS7 which I also found to be easy (all up and running within an hour!) following the guides over on the TrainSignal training website

No Comments

The Path ‘/AppName/App_GlobalResources’ maps to a directory outside this application, which is not supported.

I recently had a crazy problem on one of my asp.net 2 projects which had previously been working for ages.  I had recently had to change my localhost site root in IIS on my local dev box to another projects root to make some 3rd party site run, as it refused to run unless it was at the root of IIS.

So, once finished, I reverted the my default site’s home directory back to C:\inetpub\wwwroot\ to continue work on other projects.

When i returned to work on one of my older projects which ran in a sub folder under my local machines IIS root, i was hit with a random error;

Server Error in ‘/SharedCheckout’ Application.

The path ‘/SharedCheckout/App_GlobalResources’ maps to a directory outside this application, which is not supported.

Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.Web.HttpException:
The path ‘/SharedCheckout/App_GlobalResources’ maps to a directory outside
this application, which is not supported.

I was particularly confused by this because I hadn’t added the special App_GlobalResources directory to my project through visual studio.  Anyway after a bit of googling I found this to be due to IIS being completely confused by the extra trailing \ when defining the home directory for my site definition- so i changed it to C:\inetpub\wwwroot (removing the trailing \) and everything was back to normal.

1 Comment

Localisation – American Date’s and currencies in ASP.net

Handy web.config value to know – in Dot net if you find everything being americanised when you're not expecting it try this in your web.config under the system.web section -

<globalization culture="en-GB" />

you can obviously replace this with any of the other standard country codes.

No Comments

MySQL 5 / phpMyAdmin Installation – root account not accepted

I recently installed mysql 5 under Windows 2003, with phpMyAdmin running under IIS 6 and came across an issue trying to get phpMyAdmin to access the database- I found that the root credentials were’nt accepted. The error i receive was

“#1251 – Client does not support authentication protocol requested by server; consider upgrading MySQL client”

Apparently this is to do with me using an older version of phpMyAdmin and how the passwords are encrypted- I found an article on WebMasterWorld detailing how to resolve it;

Login from the command line to your MySQL database;

mysql -u root -h localhost -p
  • -u lets you set the username to use, in this case I’m using the root account
  • -h sets the host- I’m logging in from the local machine so used localhost- I havn’t enabled root access from any remote machines
  • -p indicates that you will be supplying a password

You will then be prompted the enter the password for your database. Once you’re in, execute the following sql to update the password

UPDATE mysql.user
SET password=OLD_PASSWORD('somepassword')
WHERE user='someuser';
AND host='somehost';

Once that’s done you will also want to flush the priviledges;

flush privileges;

You can now safely quit the mysql client with ‘exit’ and you are set!

This is also covered on the mySQL documentation site.

2 Comments

Multiple domains to reduce site loading times

In yet another effort to increase loading times on inherently graphic heavy websites we stumbled across an article on sitepoint which details a limitation across all web browsers.  The limitation, which is came from a recommendation made in the http standard, states that no more than 2 connections should be made to any one domain name.  So if your website has a bunch images, an html file and some css, your browser will only be able to download two of those at a time.  This only really becomes a problem if you have lots of images to download- if you have two large files coming down at once, that's all your connections in use, so everything else will have to wait.

You can get round this by setting up a bunch of sub-domains, pointing to your site root, in exactly the same was as the www DNS record- just add these as additional host headers in IIS- we've got images.domain.co.uk, styles.domain.co.uk, etc etc as well as the standard www.domain.co.uk, then you just set your image tags to grab all your images as normal, but substitute the www's for "images"- like wise with your css- set your link tags to reference your css at styles.domain.co.u/css/screen.cssfor example.

No Comments

CSS Sprites and a flickering problem in IE6

Working for a large publishering group who, among other things, have a large section dedicated to the sale childrens books, we have a lot of websites with really graphically heavy designs.  Specifically the designers will often put in navigation elements using non standard fonts, which they insist must be used as-is leaving us with only a couple of options;

  • sIFR
    This is a javascript/flash solution which allows you to use any font you want on a website.  It’s very simple to use- you simply add the javascript include to the top of your page, then add the sIFR css classes to the elements you want to be processed by sIFR.  You will also need to open the attached fla file and change the font in there and republish the SWF file.  At run time, the javascript then finds any elements using these classes, grabs their content, then substitutes it with a small flash SWF file, showing your title in your chosen font. 

    This is best used for page headings rather than large blocks of text (due to the processor time required to perform the conversion in real time) and, in my experience, can lead to some CSS based head aches (adding padding or margins where you dont expect it, or generally pushing other elements around) if you have a particuly tight design.

  • CSS Sprites
    Example CSS Sprite image showing both a buttons normal and over states

    This solution isn’t as nice as sIFR, as you are still having to create a graphic for every button, and a graphic for every over state etc.  However with Sprites, you dramatically reduce the download times but putting all your button graphics and all their over states in a single image, and adjusting the offset of which part of the image you see on each button, using CSS.  An example sprite with just a single button can be seen in the image on the right.

    The benefits to this include significantly reduced download times as you don’t have a individual set of headers and footers for each of the individual images- you’re just downloading the one graphic.  This also eliminated the need for pre-loaders (which never seem to make much of a difference anyway!) because as soon as the graphic is loaded, you then have all the graphics for your navigation, and their over state’s in memory.

    So for each button on the site you set the same single image file, but when you set the background image, you also set an offset like so;

    #leftNav #btnHome a {
    	background-image:url(/graphics/leftnav_sprite.gif);
    	background-position:0px 0px;
    	}
    	#leftNav #btnHome a:hover {
    	background-position:0px -26px;
    	}
    

IIS 6 Dialogue, allowing you to add Custom HTTP Headers

We went with the CSS Sprites solution in the end which went in very easily and immidiatly worked under firefox.  We did however see issues under IE6- as we roller over the buttons there seemed to be a lag before they actually redrew the normal images, as though it was downloading the graphic again; which apparently is exactly what was happening.  After a bit of googling around we found this article by Andrew Fledderjohann which had the solution we needed (as well as a few other fixes for apache etc)– a simple addition to the headers supplied by IIS when hosting the site.  In the properties for the site in IIS, add a new Custom HTTP Header called Cache-Control and set the value to

post-check=3600,pre-check=43200

This started working instantly for us totally eliminating the flicker.  You can see the results of this working up on www.franklinwatts.co.uk

No Comments

My shiny new blog

My "Psycho" face!

Welcome to my new blog!  I’m a web developer so i will be using this to post anything useful or interesting that i discover during the daily grind that may be useful
in the future and that i don’t want to slip through my vice like memory.  Hopefully some of the stuff i note down can be useful to you, assuming I actually remember to keep posting content in this one as I’m usually awful at these things.

The blog platform I’m using is BlogEngine.net, recommended from a colleague at work- it’s running on IIS7 under windows 2008 web edition on my web server at home.   This seem’s to be a good dot net alternative to the popular PHP blog platform, WordPress which is the main one I’ve user up until now.  BlogEngine has a couple of nice features, one being the ability to use XML as your primary data store so you don’t have to use SQL Server.  Everything installed easy in just a few minutes following Al Nyveldt’s screen cast; I grabbed one of their default skin’s and was able to mod it to my needs, far easier than i could with wordpress, and i was done.

I did have one issue during setup where I kept getting 404 error’s when trying to view any of the pages or posts created through the system.  I found an article on the blog engine discussion boards over at codeplex which solved the problem for me.  I had the application running in an application pool using the integrated pipeline, but i should have been using classic.  The incompatibility is due to the way IIS7 expects the web.config file to be structured when using the integrated pipeline.  As the post points out, you just have to switch it to use classic, you can then run a tool to convert the web.config file over, then switch the site to run back using integrated again.  The syntax for the tool is;

%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "BlogSiteName/"

Aside from that, so far so good!

No Comments