Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing in ASP.Net, I want to write registry from web server to client local machine. Here is my code,

C#
string sDesig = "";
            sDesig = Convert.ToString(ViewState["Designation"]);
            string sRef = "";
            sRef = Convert.ToString(ViewState["ReferenceNo"]);
            System.Text.StringBuilder sw = new StringBuilder();
            int transid = Int32.Parse(ViewState["TransID"].ToString());
            int status = Convert.ToInt32(ViewState["Status"]);
            string History = lblsrno.Text;
            string name = SessionManager.GetEmpName(HttpContext.Current).ToString();
            System.Text.StringBuilder sbvar = new System.Text.StringBuilder();
            sbvar.Append(sDesig + ",");
            sbvar.Append(sRef + ",");
            sbvar.Append(transid + ",");
            sbvar.Append(name + ",");
            sbvar.Append(status+",");
            sbvar.Append(History);

            Environment.SetEnvironmentVariable("MYVARIABLE", sbvar.ToString(), EnvironmentVariableTarget.Machine);



but it was saving in server machine. I want to save it to client machine. Anyone have idea?

Thanks in advance.
Posted

Hi,

I dont think you can access the registry of the client machine.

Instead you can go for State Management for storing the data.

State Management[^]

regards,
Karthik
 
Share this answer
 
v2
Comments
dabeeyow 19-Jun-12 7:44am    
I access the client registry but I cannot write, when i click clicked on save it saved on server machine. Do you have sample codes on how to write registry on client machine? Thanks!
Well updating registry from server will not be a easy task. you will face lots of access issues and other problems.

What i prefer to do is ; create VBSCRIPT files which can access remote computers. and execute them from webserver. Now in case you find access denied. Impersoante teh process and execute the script .

one such script is :
VB
On Error Resume Next
HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Control Panel\Desktop"
ValueName = "ScreenSaveActive"
    objReg.GetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue
If IsNull(strValue) Then
    Wscript.Echo "Verify whether or not a screen saver is being used:  The value is either Null or could not be found in the registry."
Else
    Wscript.Echo "Verify whether or not a screen saver is being used: ", strValue
End If


Also you can google it , Scripting remote computers[]
 
Share this answer
 

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