如何在网络表单中设置智能卡授权 我可以阅读智能卡的ATR ......
try {
m_iCard.Connect( DropDownList1.SelectedItem.Text, SHARE.Shared, PROTOCOL.T0orT1);
try {
// Get the ATR of the card
byte[] atrValue = m_iCard.GetAttribute(SCARD_ATTR_VALUE.ATR_STRING);
} catch {
}
} catch {
}
但进一步说不出来。
答案 0 :(得分:1)
您是否有适当的身份验证流程?如果没有,您可以访问下面的链接,它有一个教程: http://securitythroughabsurdity.com/2007/04/implementing-smartcardauthenticationmod.html
用户通过SM验证后,您可以对其进行授权: http://securitythroughabsurdity.com/2007/04/implementing-authorization-in-aspnet.html
您可以在此链接上看到完整的教程: http://securitythroughabsurdity.com/2007/04/implementing-smartcard-authentication.html
已编辑 - 可以通过以下表单实施授权:
声明
using System.Security.Permissions;
...
[PrincipalPermission(SecurityAction.Demand, Role="Administrator"),
PrincipalPermission(SecurityAction.Demand, Role="Auditors")]
public void DoSomethingImportant()
{
...
}
势在必行
using System.Security.Permissions;
...
public void DoSomethingImportant()
{
PrincipalPermission permCheck = new PrincipalPermission(Nothing, "Administrators");
permCheck.Demand();
}
IPrincipal.IsInRole()检查
if (myPrincipal.IsInRole("Administrators")
{
...
}
Web.Config - 指定web.config
中文件和/或文件夹的访问权限<configuration>
<system.web>
...
</system.web>
<location path="Admin">
<system.web>
<authorization>
<allow roles="Administrator" />
<deny users="*" />
</authorization>
</system.web>
</location>
<location path="Reports">
<system.web>
<authorization>
<allow roles="Auditor" />
<deny users="*" />
</authorization>
</system.web>
</location>
</configuration>