7

I am building an IE Addon or Extension using C#. I have created an Access Database MDB file which will be in the Program files. Now at runtime I need to copy this MDB file to Isolated Storage so that I can use it further. As I can't access AppData if Protected Mode is ON in IE. I have seen few code samples which enables me to write files in Isolated Storage, but here I need to copy my database file MDB in Isolated Storage. Please come up with some code. Awaiting your response.

Thanks

sumit_batcoder
  • 3,369
  • 1
  • 25
  • 36
  • 2
    " Please come up with some code. Awaiting your response" - ...and how did this question get 7 upvotes? – Mitch Wheat Jan 06 '11 at 10:14
  • Even if you can copy the MDB file into isolated storage, I'm not aware of any way to get the Jet engine to read it from there - you generally have to pass an actual path to Jet to get it to open MDB files – Damien_The_Unbeliever Jan 06 '11 at 10:16
  • 1
    A Jet/ACE data file needs to be read/write, so Programs is never going to be the right place to put it (it would only work when you process was running with an admin security token, or if you've set special permissions on the folder where the database is stored). The correct place for storing any Jet/ACE database is in AppData, but there are differences between Vista/Win7 and previous versions of Windows in what the API call to find the location of AppData returns. The user's profile has a number of places where it should work, but I don't know how that interacts with IE's protected mode. – David-W-Fenton Jan 08 '11 at 04:01
  • @ David-W-Fenton: You are right. But I am not interacting with DB in Program Files, usually I would copy it to Appdata on installataion as I send the MDB file with Setup. So, after being copied to Appdata the program doesn't interact with DB in Program Files. The problemhere is with IE Protected Mode in Vista or XP, my Addon isn't able to access any of these folders. So I was thinking of Isolated Storage, but it doesn't seem to work out. – sumit_batcoder Jan 08 '11 at 05:25
  • My point is that you can't ever put an MDB in the program files folder unless the process that you use to open it is running with an administrative security token, or one for a user that is a member of a security group that has read/write permission on the folder in the program files folder. In other words, you can only do it if you have a non-standard setup that's been altered by an administrator. It's simply the wrong place to ever put any MDB files, period. The only case where it would work is if you're using the MDB in program files as a template that you copy elsewhere. – David-W-Fenton Jan 10 '11 at 00:11

1 Answers1

1

Why not look at an alternative to doing this in access. There are reasons why certain things cannot be accessed in "protected mode".

diagonalbatman
  • 17,340
  • 3
  • 31
  • 31
  • Yes, definitely I can go for an alternate, but what that could be?? I need a DB file somewhere on his local system to keep the records, is there another location which can be accessed by Extensions when IE is in Protected Mode?? – sumit_batcoder Jan 06 '11 at 14:20
  • What data are you storing? Having a quick look around on the stack i found this - have to say I have never had to solution your issue, however this may help you http://stackoverflow.com/questions/1992765/how-to-access-appdata-in-ie-protected-mode-from-a-managed-bho – diagonalbatman Jan 06 '11 at 14:52
  • Thanks for the link, but I have already been through that link, but it doesn't solve the problem. Actually it's an Access Database which contains 2 tables, 1st contains Username, UserID and the 2nd contains the same fields and serves different purpose. – sumit_batcoder Jan 07 '11 at 13:27