Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Reading Registry Value</title>
        <script type="text/javascript">




            function readJREValue()

            {
                var WshShell = new ActiveXObject("WScript.Shell");
                var value = WshShell.RegRead("HKLM\\Software\\JavaSoft\\Java Runtime Environment\\BrowserJavaVersion");
                document.write("Version OF Java Runtime Environment is: " + value);
                        document.write("<br>");
            };



            function detectBrowser()
        {
        var N= navigator.appName;
        var UA= navigator.userAgent;
        var temp;
        var browserVersion= UA.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
        if(browserVersion && (temp= UA.match(/version\/([\.\d]+)/i))!= null)
        browserVersion[2]= temp[1];
        browserVersion= browserVersion? [browserVersion[1], browserVersion[2]]: [N, navigator.appVersion,'-?'];

        document.write("MSIE & ContentVerse Software Property")
        document.write("<br>");
        document.write("Browser Name & Version:  " + browserVersion);
        document.write("<br>");




        readValue();
readJREValue();


};
function readValue() {
            try
            {
                var WshShell = new ActiveXObject("CVOOCX");
            //    var value = WshShell.RegRead("HKLM\\Software\\computhink\\Contentverse OnLine\\Contentverse Flavor");
              //  document.write("Value of ContentVerse Flavor: " + value);
              document.write("<br>");
              document.write("ContentVerse Flavor: " + WshShell.Flavor);
              document.write("<br>");
              document.write("ContentVerse Installed path " + WshShell.Home);
            //  document.write("<br>");

              }
              catch(e)
              {
                 document.write("Contentverse Dll is not registered");
              }


            };

        </script>
    </head>
    <body onload="javascript: detectBrowser()">

    </body>
</html>





This code is working fine when i am run this file from my desktop, but when i Keep this file under wwwroot and then trying to exeute like Http://localhost/javascript.html, it is displaying only result from readvalue() and not executing the readJREvalue().
Posted
Updated 12-Nov-13 8:27am
v3

1 solution

It is a permission problem.
When you run from the desktop you use your own identity context and have permission to read registry.
But when running form inside iis you got the identity of the pool (ApplicationPoolIdentity by default). It is more than possible that that identity has no permissions to read registry...
 
Share this answer
 
Comments
Rayan Khan 9-Oct-13 6:41am    
but readvalue() function is executin ........Then readJREvalue is not executing..
Kornfeld Eliyahu Peter 9-Oct-13 7:11am    
According the code you posted readvalue does not read registry...
Rayan Khan 9-Oct-13 7:33am    
Then give proper solution....
Kornfeld Eliyahu Peter 9-Oct-13 8:01am    
Solution to what?
That readvalue does not read the registry?
Or that pool identity has no permissions to read registry?

To solve your permission problem you must add permissions to your pool identity - or better change pool identity...

But I have to say - without knowing what you try to do - that reading the registry from inside a web application is bad (very bad) practice. So the real solution is to solve you app problem without reading it...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900