The Portland White's

Family blogs, photos, files and news.
Welcome to The Portland White's Sign in | Join | Help
in Search

Kelly White

The professional, the personal, and everything else...

Permission Denied for Vista Gadget - Msxml2.XMLHTTP

Vista Gadgets are very cool.  They're like these mini-apps that can run in your sidebar and provide you with some pretty cool functionality.  You write them just like you're writing a web page.  You can use Javascript or Silverlight, make calls out to RSS feeds or web services, and provide some pretty cool services.  They are way simple to install.  Typically they are distributed as a zipped files which you then unzip and place in a certain directory.  Presto!  Viola!  It's magic!  Not really, but it is simple and cool and it works.  Well, mostly.

Have you ever downloaded and installed a Vista gadget and then not been able to get it to run propertly?  Heh, I have.  I tried to download my own Silverlight Tip of the Day Gadget and install it on my home machine.  I downloaded it, installed it, and the blasted thing didn't work.  It just sat there and said "Connecting..."  What?  How could this be?  I was frustrated, I was befuddled, I was flabbergasted.  Other people have downloaded my gadget and and successfully run it on their own machines and it worked just fine.  Or so I thought.  Was there a bug in my gadget and no one was telling me about it?  Was no one even downloading and using my gadget?

I copied the gadget folder from my machine at work and did a binary diff between that and what was on my home machine.  There was no difference.  I then tried debugging the gadget, but not until I first found a handy debug viewer app for that.  i put a try/catch block around this line of code, launched this handy tool and blog entry describing how to debug your Vista gadgets.  I modified my javascript with a try/catch block and wrote out the exception using System.Debug.outputString().  I then started up the DebugView and then launched my Silverlight Tip of the Day Gadget.  Immediately I was able to see there was a permissions error, and eventually I was able to narrow it down to a specific line of code.



"Ah hah," I thought, "I have found it."  So i started searching on Live and found a lot of similar people with similar symptoms but no solutions or even acknowledgements that this was the problem.  I then started using that other search tool that has 60% market share but still didn't find anything.  I just didn't understand it.  Where was the community help explaining what the problem isand how it can be overcome?

At this point I knew there was not problem with the code.  If anything it was a problem with permissions.  Yeah, once I said that word a light clicked on in my head.  Now which one of you geniuses is going to be the one who asks me if I run UAC (User Account Control)?  The answer to that question is yes, of course I run UAC.  I run UAC at home, at work, on all my Vista machines.  I'm not humiliated or embarrased by this fact, I like it.  UAC does not hinder me or make me less productive.  I figure given that I exclusively use a blank keyboard means I'm entitled to the privelage of using UAC without having to take crap from any of you script kiddies who shout out against it.  Stick out tongue

At this point I'm pretty sure I've identified the problem.  However I still don't have a solution.  "Sure," you may say, "turn off UAC and everything will work great".  Whatever.  That only hides the problem.  But what is the source of this problem?  That's the $64K question.  The source of this problem is that this gadget was downloaded from a different or "untrusted" machine.  Consequently, some javascript would run just fine for this gadget, and yet other javascript would not.  Once I realized this I immediately went into the gadgets folder, right clicked on the offending script file, and looked at the permissions.  Yep, just as I thought, I'd seen something like this before.  I then selected to unblock the script, removed the gadget from the sidebar, and then re-added it.  Nothing happened.  Huh?  How could this be?  So I proceeded to do the same thing and unblock every file that existed in folder/subfolder for this gadget.  Viola!  Presto!  It's magic!  Whatever, but at least my gadget was now working.

So there you have it.  If you're experiencing the same problem please don't think the solution is to turn off UAC.  The problem is that those files are not trusted and the real soution is to make them trusted.  My next task is to find out how I can automatically make those files become trusted.  I'm not sure how to do that yet, but I'm thinking that writing an installer for my gadget should do the trick.

If you have a Vista gadget which is being distributed as a zip file, please remember to include a readme file.  That file should explain both this problem and how the users can unblock the downloaded files in order to use your gadget.  And never recommend that anyone should disable UAC in order to use your gadget.

I hope this helps.


Published Thursday, February 28, 2008 10:04 PM by kelly
New Comments to this post are disabled
PDXUX.Net Logo
PDXNA Logo
Powered by Community Server, by Telligent Systems