.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

What registry keys are responsible for file extension association?

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :.NET Framework
I'm trying to associate file extension to start some type of files with my application. Which registry keys I have to modify to be sure, that when user double click at file it opens with my application. And how get delete/modify permisions to key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice"? This key created after setting default program by "Open with" dialog. I've tried: string ext=".eee"; RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+ext); RegistryPermission f = new RegistryPermission(RegistryPermissionAccess.Write, r.Name); f.Assert(); r.OpenSubKey("UserChoice", true); //at this step "Requested registry access is not allowed." exception occured

View Complete Post

More Related Resource Links

Access Control: Understanding Windows File And Registry Permissions


Understanding the ACLs that govern permissions and rights before an operation is allowed to proceed is critical to enhancing security.

John R. Michener

MSDN Magazine November 2008

How to show link file extension (lnk) in Explorer

My folders normally shows the file name extension.  But I have a folder full of window links and DOS links. I'm sure that is not the correct termioligy but it is the best I can do. I think I'm talking about .lnk and maybe .pif files. Anyway, the extension do not show in the folder listings. Can I make them show?   Thanks  

How to use (add, read, change, delete) registry keys with vb.net

Find this tutorial on Dot Net SourceReason of this project:This is the next part of the previous tutorial. We'll learn here how to add, change, read, delete registry keys and values using vb.net.I included a sample that contains all those functionality.Project details:1- How to add a registry key/value2- How to read a registry value3- How to delete a key or a value4- Changing a value or a key5- Hints to use registry with VB.net6- The registry reader (VB.net)1- How to add a registry key/valueOne thing that I think I forget to notice. A folder in the registry is name "key" and the elements in this key are named "values".There's a description of each value type in the 5th tutorialNow we'll see how to add a key or a value.Probably you have thought where we'll put it and whether it's a key or a value.So we have 2 things to notice.Visual Basic will automatically show you the hives (they are stored in).You'll have only to choose the needed one.To do that paste the following line. My.Computer.Registry.CurrentUser.CreateSubKey("TestKey")This line will create a key in the HKEY_CURRENT_USER hive and will be named "testkey"Now let's move on to see how to set a value.For the value we'll need three things: Value path, Value name and value value. We can also precise the value type if not Visual Basic will try to assign the value type depending o

Encrypting config file's connection string and keys


 Is aspnet_regiis.exe secure? If i encrypt using aspnet_regiis.exe, will it automatically decrypt the string and wont give any error? Need an insight into this stuff....any suggestions? Is Rsa the best option or wat? Wat's the best way to encrypt/decrypt programmatically?

url rewrite for images(.jpg file extension not .aspx)



I have stored DB images. and I try to access images using url rewrite. But it is not happaning.

I tried this scott methord. http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx. i tried with Application_BeginRequest, but no use

Basically Client don't want to use .aspx extension for images

Is it possible acess db images with out using .aspx file name extension?  then can anybody tell me how to achieve this!!!!!!!!!!!!

My sample url is "www.sample.com/images/folder/imagefilename.jpg" I want to rewrite to "www.sample.com/images/pimges/default.aspx?file=imagefilename.jpg&cat=folder"



Consistency validation for SQL Server registry keys


I cannot get past this support rule when I attempt to install SQL Server 2008 RC0.  When I attempt to drill into the failure the popup states "The SQL Server registry keys from a prior installation cannot be modified.  To continue, see SQL Server Setup documentation about how to fix registry keys."


First off, why would the SQL Server 2008 RC0 install attempt to modify registry keys from a prior installation if I am attempting to install it side-by-side with a prior install of SQL Server 2005 Developer Edition?  


Second, can anyone point me to the SQL Server Setup documentation that walks me through how to go about fixing these registry keys?


Any help would be greatly appreciated.  Thanks in advance for your help.


Wendell G


how to convert file with .tvr extension to notepad then read the file



            My text file consist of following data.In the below file i have to read dates( for example 9/13/2010 and corresponding Time 1300-2100) and empname Abbott,Luis insert into databse. similraly remaining dates.I have to ignore first 15 lines





-------------------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- -------------
 Monday Tuesday Wednesday Thursday Friday Saturday Sunday 
 9/13/2010 9/14/2010 

couldn't open a file extension .cert from browser


 There is a file with an extension .cert sitting on web server. when i tried to access it through URL, i couldn't open it and didn't give any error message also. I verified the file existence in that folder and also i could open it using notepad. Is there any MIME to be added to open this file?

How can I get a list of applications registered for a certain file extension in a WPF application?

I'm looking for a Win32 or Shell function that can be called from a WPF application to get a list of registered applications in Windows for a specific file extension. For instance if I would pass ".rtf" to the function it should return something like "Microsoft Office Word|C:\Program Files\Office\Winword.exe|Wordpad, C:\Program Files\Windows NT\Accessories\wordpad.exe". I need this to construct a 'Open with' context menu somewhat related to the file context menu in Windows Explorer. In Windows Forms I could get the the Windows Explorer context menu with IContextMenu, IShellFolder etc. But this approach requires a WndProc because the context menu data will be send with WM_ messages. But for WPF this is not an acceptable solution because there is no WndProc. I know that I can get that data from the registry HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList but I will not use it because in a future Windows release the registry structure may change and this would break my application. I also don't want to mess around in Windows internal data. And there is no list to get anyway. All I found in the registries .png\OpenWithList key was a DllHost.exe and mspaint.exe. But DllHost.exe is no application to open a .png file. And the mspaint.exe doesn't specify a path. The display names are also missing.

file extension


how do u check the file extension in an upload control post


file extension problem


I try to upload  .mdb file to wss 3.0 and get an error message. When I go to Central  Administration - Operations - Blocked files type, I can delete the extension from the list, but I cannot click ok - the change doesn't stay.  Please, help



Issue reading x64 Registry keys


I have a C# console app compiled with .Net 2.0 in 32 bit machine. This app run fine in 32bit machine. But when I run in x64 machine I get some issues.

I figured out that the information about app was installed correctly on HKLM\SOFTWARE\Wow6432Node\MyCompany\MyApp\ registry key.

But in my code I have hard coded the following string "SOFTWARE\MyCompany\MyApp"

I thought that WOW64 could translate correctly from "SOFTWARE\MyCompany\MyApp" to SOFTWARE\Wow6432Node\MyCompany\MyApp. I am using the class RegistryKey from the Framework. I know that all is correct because it works in 32bit but seems that I am missing something with x64. I got a look at Registry Redirection and Reflection but could not see a solution. Any idea?





how to registry dll file in asp.net (c# or javascript)


hii to all

i have a site thet need to check some dll file in the client registry

how can i check it and if the is no dll how can i add it to the registry


c# or javascript



The filtering process could not be initialized. Verify that the file extension is a known type and i


I have medium farm in sharepoint 2007 and sql 2005.

I see errors in the crawl log due to file extension is not known for PPTX .

Where can I add file extension? What is the best way to handle this error?



Directory listing without showing file extension?



I've seen various tutorials and scripts online which show how to create a directory tree which list the file name, size etc.

My question is, I need a script that is basically a normal directory listing but it doesn't show the file extension.  If anyone can even point me in the right direction it'd be of much help!



any way of adding extension after unzipping a file in asp.net



i generated a zip file of xml file,,ie aa.xml.zip....but after downloading that file,i extracted the zip file,then i cant getting in the correct format of xml file with extension .xml...how will possible this...anyone help me to solved out this problem..TIA.........

Bug? Writing to 64/32 bit Registry Keys


I had been searching for a way to write to the 64 and 32bit (WOW6432Node) registry keys becuase it's hard to predict where external processes I'm working with will be reading from.

.net 4 has a great new way of pointing explicitly to the keys with the RegistryKey.OpenBaseKey method.  It works fine until I point at:


RegistryKey RegCUBase32 = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);


This should (In my mind) Push me to the HKCU\Software\WOW6432Node when I try to write to the HKCU\Software  (that's how things work in HKLM)
-but it does not

See the following code:


using System;
using Microsoft.Win32;

  public static void test()
   String regPath = "SOFTWARE\\Test"; ;
   RegistryKey TestKey;

   //works fine:
   RegistryKey RegLMBase64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
   TestKey = RegLMBase64.CreateSubKey(regPath);
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend