本文介绍了ASP.Net网络应用程序和注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从网页

申请访问注册表是否有限制?


以下代码适用于Windows应用程序,但来自我的网络应用程序

在尝试打开密钥时给出错误对象引用未设置为对象的实例




Dim strKey As String =" Software\Microsoft\Internet

Explorer \ PageSetup"

Dim oKey As RegistryKey = Registry.CurrentUser.OpenSubKey(strKey)

Dim s As String = oKey.GetValue(" header","")

oKey.Close()


但是这段代码可以在网络应用程序中使用:


Dim strKey As String =" Software \ MicroSoft \ Windows NT \ currentVersion"

Dim oKey As RegistryKey = Registry.LocalMachine.OpenSubKey(strKey)

Dim s As String = oKey.GetValue(" ProductID","")

oKey.Close ()


我可以给我们b app打开并修改密钥的权利?


-

Ray Greene

Are there restrictions on accessing the registry from a web
application?

The following code works from a Windows app but from my web app it
gives the error "Object reference not set to an instance of an object"
when it tries to open the key.

Dim strKey As String = "Software\Microsoft\Internet
Explorer\PageSetup"
Dim oKey As RegistryKey = Registry.CurrentUser.OpenSubKey(strKey)
Dim s As String = oKey.GetValue("header", "")
oKey.Close()

However this code works from the web app:

Dim strKey As String = "Software\Microsoft\Windows NT\currentVersion"
Dim oKey As RegistryKey = Registry.LocalMachine.OpenSubKey(strKey)
Dim s As String = oKey.GetValue("ProductID", "")
oKey.Close()

Can I give the web app rights to open and modify the key?

--
Ray Greene

推荐答案





好​​的,我想要做的是在打印前以编程方式设置IE的打印设置

。有没有办法从网上申请

申请?


-

Ray Greene



OK, what I was trying to do was set up IE''s print settings
programatically before printing. Is there a way to do this from a web
application?

--
Ray Greene





否。可能有一些CSS设置可用于@ page在一个

" @media print"部分。有些浏览器甚至可能不会忽略它们。


Andrew



No. There may be some CSS settings that you can use with "@page" in a
"@media print" section. And some browsers might even not ignore them.

Andrew


这篇关于ASP.Net网络应用程序和注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 07:49