问题标签 [system.security]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
exception - 初始化 StructureMap 引导程序时引发 System.Security.SecurityException
我正在使用 Visual Studio 开发服务器(内置 VS2010 的 Web 服务器)在本地运行一个 .NET 4.0 Web 应用程序,在过去的几个月里,我的 StructureMap 引导程序文件运行良好。
我正在使用 StructureMap 2.6.1
我没有更改 Bootstrapper 文件或 Web.config 文件,突然,我在尝试启动我的 Web 应用程序时遇到了这个奇怪的错误。
这是从网站抛出的错误:
读起来有点难。它说:
这是我的引导程序文件中的代码:
该行引发了错误:
我已经尝试将这些行中的每一行添加到我的 Web.config 文件中,一次一个,但它们没有解决问题:
和
有没有人有任何想法或可能听说过这样的问题?这很重要,如果没有正确启动 StructureMap 的 b/c,我的整个应用程序将无法运行。
谢谢,迈克
更新:
好的,所以看来我的问题是本地的。此处的其他开发人员可以下载代码,并在他们的本地计算机上正常运行。奇怪的。他们很好地引导 StructurMap 并且所有实例都已解决...
关于为什么我的机器在本地为我的 Web 项目以调试模式运行时无法引导 StructureMap 的任何想法?
c# - SSRS 检查用户是否在使用自定义程序集的组中
我为我的 SSRS 项目创建了一个自定义程序集。
自定义程序集有 2 个功能,IsInGroup
并且MyTest
:
1) 返回字符串“Hello World”的基本函数MyTest
使用表达式从报告中完美运行=SSRS_Custom_Functions.Class1.MyTest()
2)IsInGroup
返回布尔值的函数不起作用。这是使用System.Security.Principal
命名空间来检查传递给函数的用户名是否存在于传递给函数的组中。当尝试使用 expression 调用它时=SSRS_Custom_Functions.Class1.IsInGroup(User.User1, "MyGroupName")
,报告会出现以下错误消息:
请求 System.Security 类型的权限失败
我已经根据Microsoft KB920769rssrvpolicy.config
修改了 ReportingServices 文件路径和VisualStudio 文件路径中的配置文件。RSPreviewPolicy.config
我添加了一个CodeGroup
给FullTrust
我的自定义程序集。
以下内容已添加到策略级别元素中:
我仍然收到与上述相同的错误消息。
c# - 如何获取某个用户或组使用的某个文件系统对象的所有权限列表?
我在 C# winh .NET4 中执行此操作。很容易获得任何文件或文件夹的当前用户凭据(像这样)。但问题是要获得任何给定用户或组的权限集合(读取、读取属性、写入等),我找不到解决方案。文件和文件夹位于网络共享资源中。用户和组基于 Active Directory。使用 System.DirectoryServices 管理帐户非常容易。但是文件系统对象的权限不在 Active Directory 中,这就是问题所在。
我将非常感谢您的帮助!
asp.net-mvc-4 - AppHarbor 负载平衡云部署上的访问和身份 WIF“密钥无效”
现在所有。
在 AppHarbor 上使用 Identity and Access 和 Azure STS 的 MVC 应用程序遇到一些问题,给出“密钥在指定状态下无效”错误。
据我所知,这是由于使用机器密钥的默认加密,这显然不适用于负载平衡的 scnario。
我尝试用 RSA 类 RsaEncryptedSessionSecurityTokenHandler 替换: SessionSecurityTokenHandler
这会选择一个要使用的 pfx 文件密钥(使用 SelfCert 创建),但是虽然这在本地工作,但它在 appharbor 站点上不起作用: System.Security.Cryptography.CryptographicException: Keyset does not exist 我猜这是因为密钥不仅仅与文件相关联。
那么如何解决原来的问题呢?一直在寻找解决方案的一天,但似乎没有任何东西适用于这种情况。
TIA
编辑:我尝试过修改此代码:SessionSecurityTokenHandler 尝试使用 DPAPI 解密 RSA 加密 cookie 中的 SessionSecurityToken;为什么?
用于新的 WIF 4.5 内容,如下所示:
但 e.ServiceCertificate 始终为空。
有什么想法吗?
c# - NetworkInterface.GetAllNetworkInterfaces() 导致 System.Security 异常
我在框架中使用了微软添加。我正在从主主机加载一个加载项,并且在加载项中我写了:
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces()
. 上面的行导致 System.Security 异常。完整的异常消息说:[Request for the permission of type 'System.Net.NetworkInformation.NetworkInformationPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.].
请帮助并让我知道如何为加载为加载项(反射)的 dll 设置安全权限。
c# - 在 C# 中以编程方式配置 Win 7 网络适配器
我想通过 c# 以编程方式配置 Windows 7 中的所有活动网络适配器。
我试过以下代码:
但它只是更新默认网关并没有改变其他任何东西。
我也使用过 netsh 命令:
但它适用于第一个适配器,之后它会出错:
“DHCP服务配置失败,接口可能断开。”
如何在 C# 中配置所有适配器?
c# - Key not valid Error in One Project But Works In Different Project From Same Solution
I have a C# solution that uses System.Security to decrypt the password to a TFS server. The security routines are kept in a separate project within the solution. There are two other projects in the solution that use the module to decrypt this information.
It's using DPAPI and LocalMachineKey encryption. The two projects that get deployed from the solution are a Windows Service .exe and a .dll.
Everything's been working fine, except recently I had to test a new deploy of one of the projects (a TFS Work Item Event Handler) that uses the decryption module. I built the project on my machine, and deployed the dll to the test TFS server. I promptly began to get this error:
Now, what's driving me absolutely crazy is that the other project (a Windows service) that uses the exact same module continues to work just fine. The passwords are the same, the config files haven't changed, but one application works and the other one...doesn't.
Can anyone point me in a direction to see what happened? Building the project on the test server doesn't seem to help, neither does reencrypting the password on the test machine to make sure it's using the right key. I've been tearing my hair out for two days now--this is a really minor change, but I can't deploy it until I can at least test it, and I don't want this problem to happen on the prod machine.
asp.net-mvc-4 - 中等信任主机上的默认 VS2012 ASP.NET 网站模板
我有一个使用 VS2012 创建的默认 ASP.NET 网站模板项目。我正在尝试将其发布到仅允许中等信任的 1and1.com。显然,这个模板需要完全信任,但我不知道我需要做什么。
我得到的错误是......
c# - C# Rijndael 在尝试解密时出现运行时错误填充无效或无法删除
Padding is invalid and cannot be removed
尝试解密某些数据时出现运行时错误。我已经阅读了我在 stackoverflow 上找到的所有类似线程,并考虑了以下问题:
给定一个与用于加密的密钥不同的解密密钥可能会带来上述问题。但是,正如您在用于测试目的的源代码中看到的那样,我对密钥进行了硬编码,但仍然出现运行时错误。
应用程序可能会尝试使用与用于加密的填充模式不同的填充模式进行解密。在加密或解密过程中明确设置模式并不能解决问题。
有人说您需要使用该
FlushFinalBlock
方法,以便告诉应用程序将最后的位放入blocksize
. 试着把它放在 Write 方法下面,也没有用。
以下是我的代码片段:
从昨天早上开始,我一直在努力让它工作。到目前为止,我发现的解决方案都没有在我的应用程序中起作用。我知道代码可能看起来有点乱,但请不要介意没有使用的部分——一旦我得到这个工作,它肯定需要一些重构。
如您所见,在使用硬编码密钥和 IV 进行测试时,仍然会发生运行时错误,因此传递与用于加密的凭据不同的凭据进行解密不是原因。
任何人都可以提出如何解决这个问题的想法吗?谢谢。
c# - RSA 加密返回不同的输出
我是 RSA 加密的新手,我一直在尝试了解它是如何使用 .Net 的System.Security.Cryptography
。
使用上面的代码,每当我重新启动应用程序时,我都会为相同的输入获得不同的加密字符串。我想知道这是否是正常行为,如果不是,如何预防。
例如,程序为输入“Hello”返回以下字符串:
当我重新启动应用程序时,相同输入的输出将是:
但是,当我为我的 RSA 加密类创建新对象时,所有对象都返回相同的输出。