Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在此上下文中不可访问,因为它是朋友_Asp.net_Vb.net_Webforms_Cryptography_Saml - Fatal编程技术网

Asp.net 在此上下文中不可访问,因为它是朋友

Asp.net 在此上下文中不可访问,因为它是朋友,asp.net,vb.net,webforms,cryptography,saml,Asp.net,Vb.net,Webforms,Cryptography,Saml,我从另一个C#项目中提取了一些代码并将其转换为vb,但现在我得到了错误: 在此上下文中不可访问,因为它是friend Imports System.Security.Cryptography Public Shared Sub Sign() CryptoConfig.AddAlgorithm(GetType(RSAPKCS1SHA256SignatureDescription), "http://www.w3.org/2000/09/xmldsig-more#rsa-sha256")

我从另一个C#项目中提取了一些代码并将其转换为vb,但现在我得到了错误:

在此上下文中不可访问,因为它是friend

Imports System.Security.Cryptography  

Public Shared Sub Sign()
  CryptoConfig.AddAlgorithm(GetType(RSAPKCS1SHA256SignatureDescription), "http://www.w3.org/2000/09/xmldsig-more#rsa-sha256")
End Sub

所需的是
System.Deployment.Internal.CodeSigning
,但此命名空间似乎没有
RSAPKCS1SHA256SignatureDescription

导入的名称空间是
System.Security.Cryptography
,但我开始认为这是从错误的库中派生出来的

Imports System.Security.Cryptography

Namespace System.Security.Cryptography
  Friend Class RSAPKCS1SHA256SignatureDescription
    Inherits RSAPKCS1SignatureDescription
    Public Sub New()
  End Class
End Namespace

有人能提供此错误消息的详细信息吗

这一错误似乎并不表明微软所说的是:

错误ID:BC30389



注意错误消息是如何引用
系统.安全.加密.RSAPKCS1SHA256SignatureDescription
?这就是您的代码所引用的类,并且该类被声明为
Friend
,因此您不能使用它。如果需要
System.Deployment.Internal.CodeSigning.RSAPKCS1SHA256SignatureDescription
类,则需要导入该命名空间


System.Deployment
命名空间首先需要添加到项目中,以便引用
内部.CodeSigning