将注册表从服务器写入客户端的本地计算机 [英] Writing Registry from Server to Client's Local Machine
本文介绍了将注册表从服务器写入客户端的本地计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在ASP.Net中进行开发,我想将注册表从Web服务器写入客户端本地计算机.这是我的代码,
I am developing in ASP.Net, I want to write registry from web server to client local machine. Here is my code,
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.
推荐答案
我认为您无法访问客户端计算机的注册表.
相反,您可以去状态管理来存储数据.
状态管理 [
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
从服务器更新注册表将不是一件容易的事.您将面临很多访问问题和其他问题.
我更喜欢做的是;创建可以访问远程计算机的VBSCRIPT文件.并从网络服务器执行它们.现在,以防万一您发现访问被拒绝. Impersoante处理并执行脚本.
这样的脚本之一是:
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 :
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
您也可以在Google上进行搜索,为远程计算机编写脚本 [ ]
Also you can google it , Scripting remote computers[]
这篇关于将注册表从服务器写入客户端的本地计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文