Programming “gotcha” when you code for Vista and beyond!

by rahul 2/7/2009 10:49:29 PM

If you blog, and haven’t used any of my plug-ins for Windows Live Writer, may be you should. In this post though, the agenda is not to push you to install the plug-ins but tell you about my experience with Application.StartupPath and how problematic it could be!!!

Well, it all started when I decided to write a few plug-ins for my favorite Windows Live Writer. The SDK was easily available, and I found that any new plug-in was required to be installed in the Plug-in folder inside WLW Installation folder. I never realized that a code as simple as Application.StartupPath would cause so much problem for me. In fact, quite a lot of users who downloaded the plug-in complained that it just doesn’t work. Finally, I had to give a suggestion that they should run WLW as an Administrator and the issue would go away!

Anyways, I decided to fix this issue once and for all, and the only change that was required was to use Application.UserAppDataPath instead of Application.StartupPath. By the way, in case you don’t know why this happens only in Vista… you should read this. In a nutshell, it is because of security implications, and Vista is much more strict than its predecessors. You should prefer using the UserAppDataPath in case you are writing a new file. Application.StartupPath is NOT the way to go.

Hope this helps,
Rahul


Quote of the day:
Fall not in love, therefore; it will stick to your face. - National Lampoon


blog comments powered by Disqus

Rahul Soni

Rahul Soni  Twitter

 LinkedIn

 Facebook

 Email me



Vivek Kumbhar

Vivek Kumbhar  Twitter

 LinkedIn

 Facebook

 Email me


Stack Exchange

profile for Vivek at Server Fault, Q&A for system administrators and IT professionals

profile for Rahul Soni at Stack Overflow, Q&A for professional and enthusiast programmers

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0