views:

281

answers:

5

Is there a way to read the windows registry from a web based application with no user interaction? im open to language suggestions, any language will work i just need to know how to pull a certain string from one particular registry key.

EDIT: incase this wasnt clear, im operating inside of a web-browser, obviously.. its a web application, weather it be silverlight, java, php, or something else.

A: 

.NET offers ways of doing this, http://msdn.microsoft.com/en-us/library/85t3c3hf.aspx

Ed Chaparro
i believe your missing the fact that ill be operating in a webbrowser and cant use that
Tommy
+1  A: 

Nope. Web techs such as silverlight are designed to run sandboxed by default. There are certain actions that are allowed/enabled by silverlight that break that convention but they all require explicit confirmation by the user.

Sky Sanders
how would i access the registry /with/ user confirmation then?
Tommy
I think you can't http://forums.silverlight.net/forums/t/37308.aspx
Eineki
I said there are _certain actions_, registry access is not one of them. So - the short and firm (eh.. ) answer is still Nope. Can't do that in silverlight.
Sky Sanders
A: 

So, the php tag here is wrong? Who can remove this tag? Mods?

f13o
Done (anyone with >500 rep can edit tags), but you would have been better putting your note in a comment -- it's by no means an answer to the question.
Andrew Aylett
Ok. I will add as comment in future. Thanks for reaction.
f13o
A: 

I'm afraid that the short response, as already stated, to your question is NO, you can't access the registry from client.

Maybe you can resort to an activex (bounding your application to Microsoft browsers)

Maybe, if your goal is just to implement some sort of user/license verification (I interpret in this way your response to my comment), you may find useful the webstorage / client side storage alternatives.

As I know there are different implementation, technologies, you can leverage on.

A starting point for your investigations can be

http://wonko.com/post/search-pad-browser-storage

Eineki
+2  A: 

This can be done in java:

public class RegistryRead {
 public static void main(String[] args) {
   RegistryRead demo = new RegistryRead();
   demo.doit();
   // IO.PressAnyKey();       
   }

 public void doit() {
   displayUserName();
   displayODBCDSN();
   }

 public void displayUserName(){
   com.ms.wfc.app.RegistryKey regKey;
   String userName;
   regKey =
     com.ms.wfc.app.Registry.LOCAL_MACHINE.getSubKey
       ("Network\\Logon");
   if (regKey == null) {
     userName = "Unable to get username from Registry!";
     }
   else {
     userName = (String) regKey.getValue("username");
     }
   System.out.println("Username : " + userName);
   }

 public void displayODBCDSN() {
   com.ms.wfc.app.RegistryKey regKey;
   regKey =
     com.ms.wfc.app.Registry.CURRENT_USER.getSubKey
       ("Software\\ODBC\\ODBC.INI\\ODBC Data Sources");
   if (regKey == null) {
     System.out.println("Unable to get ODBC DSN Registry!");
     }
   else {  
     String dsn [] = regKey.getValueNames();
     System.out.println("ODBC DSN defined : ");
     for(int i = 0;  i < dsn.length; i++) { 
       System.out.println(dsn[i]);
       }
     }
 }
}
halomaster