Session Cookies - Bug in IE7

February 25, 2009 09:25 by nathan

Here is a problem I found recently, I had a website where the Session Cookies keep getting reset on every page load but it was happening just in IE7 not in Firefox, Safari, IE6 etc.

After a while I found the solution was that I had used an underscore character "_" in the domain (website) name e.g. my_website.localhost
This meant IE7 dropped the authentication cookie when there was an underscore in the domain name (possibly as it can not represent an underscore when it saves the referencing cookie session).

So I changed the domain name e.g. my-website.localhost and now the cookie sessions are fine in all browsers.

This is a weird problem but seems to be considered a general bug with IE7 and domain cookies. Hopefully IE8 will have a fix for this problem.

So for future reference don't use underscores in domain names, or be prepared to live without session cookies in IE7.


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

jQuery XML and MIME types

February 16, 2009 08:49 by tim

We're really getting into jQuery these days.  Since it's adoption by the .net framework team, we're seeing more and more AJAX UI with data read in via jQuery to make some really cool looking sites

However, there was a problem we had recently with MIME types. We host all our stuff on IIS and this comes pretty much ready-rolled with most of the MIME types set up.  For those of you that don't know what a MIME type is; It's a rule which the web server uses to process certain files based on their extension. JPG, for example, is pretty much going to be a picture so the server allows these as binary downloads, whereae ASPX is a server-side page so the MIME type for ASPX runs through an extra process to translate the code into a working web page

Browsers also use the MIME type to decide how to display the pages, or images, and set them up correctly in the browser. application/rss+xml signifies that there is an RSS feed somewhere nearby and the browser will then highlight the Feed button so the user know where to get the feed from and set it up in their favourites

Which brings me nicely on the the problem that this post is meant to remedy.  We were using the jQuery $(document).ready(function(){$.ajax({type: "GET",url: "tim.xml",dataType: "xml", success: function(xml) { stuff to retrieve the xml and the process the node we were interested in.  Worked fine locally using IIS on any browser we threw at it.  However, we had to upload this to a 3rd party server and the "text/xml" MIME type hadn't been set up.  FireFox didn't seem to mind, but IE was throwing it's toy out of the pram and just not playing ball whatsoever.

After much blog and forum digging, we cam across the explanation on the jQuery site : http://docs.jquery.com/API/1.1.1/Ajax

So there you have it; if somethings not behaving as it should, before you change the code, be sure to verify your MIME types are set up as they should be. I initially thought this was an issue with $(document).ready but amending this didn't fix my issue!!

 

 


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

System.Uri.Query and the Ampersand character

February 6, 2009 09:50 by nat

I recently had a requirement to place an ampersand in a querystring as a value, now this is handled perfectly well by UrlEncoding when using the Request.QueryString() method, however, when dealing with a Uri.Query, it goes a bit wrong. When inspecting the Uri.Query value even after UrlEncoding the ampersand, %26 ("&" when UrlEncoded) has been UrlDecoded already, before you have a chance to do anything about it.

The way round this that I found is to HtmlEncode the ampersand too, so it ends up as "%26amp%3b", e.g.

string theUrl = "http://www.domain.co.uk/pagename.aspx?qskey=" + HttpUtility.UrlEncode(HttpUtility.HtmlEncode("lorem & ipsum"));

Then to grab it out of the Uri.Query value do the following

HttpUtility.HtmlDecode(this.Query.Replace("&", "%26"))

Now the querystring & delimiters show as "&"s and the encoded one as "%26".

 

 


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Windows Live Mesh - Synching

February 5, 2009 17:59 by gareth

I have previously blogged about Windows Live Mesh and how useful the Live Desktop feature is. Well following a forced stint of working from home I realised how powerful this is.

On my home PC I have Live Mesh installed and logged in using my LiveID. On my PC at work I have Live Mesh installed and logged in using my LiveID.

Say I am working at home on work projects that are stored on my work computer. From my home PC, I go to my Live Desktop and create a new folder, I then associate the 2 computers I want to synch this directory to (namely work and home).

The new folder appears on both computers immediately. I can then copy into the folder on my work computer - the working documents and files that I am need during the day.

This automagically synchs continuously with the folder on both my Live Desktop and my home computer (for the techies - it uses a version of SoiurceSafe). Any edits/adds/deletes I do on my home computer are reflected in the synched directories.

No need for VPN, no need for copying everything onto a flash drive, it's seemless and doesn't eat up any noticeable bandwidth or CPU.

Simply put, everything I work on at home is synched to my work computer, and everything I work on at work could be synched to my home computer. Outstandingly useful!

If this is just the begining of cloud computing then there is plenty to be excited about!

For those of you who use more than one computer in an average day - get Live Mesh now. It'll soon have mobile capabilities too.

 


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

IE8 release candidate 1

February 2, 2009 09:07 by gareth

So Microsoft released IE8 RC1 on Friday (well at least thats when I got an update notification).

I've been using it ever since - it's not a huge change from the recent Beta, which is good, because it is actually a great browser with some handy debugging tools.

 http://www.microsoft.com/windows/internet-explorer/beta/default.aspx

Be warned, the installation requires 3 reboots, and the second reboot seems to reset your desktop to the factory default, only for it to reappear on the third reboot. Not a nice experience!

 

 

 


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Calendar

September 2010
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

Tags