首先要参考的文章是:《 ASP.NET 模拟》http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconASPNETImpersonation.asp
当然这篇文章MSDN软件中也有
然后下载:Aspnet_setreg.exe http://download.microsoft.com/download/2/9/8/29829651-e0f0-412e-92d0-e79da46fd7a5/aspnet_setreg.exe
运行Aspnet_setreg.exe
示例命令如下:aspnet_setreg -k:SYSTEMaspnetid -u:"name" -p:"pwd"
然后在注册表中将aspnetid节点授予NETWORK SERVICE读取的权限
web.config中<identity>配置为:
<identity impersonate="true" userName="registry:HKEY_LOCAL_MACHINESYSTEMaspnetidASPNET_SETREG,userName" password="registry:HKEY_LOCAL_MACHINESYSTEMaspnetidASPNET_SETREG,password"/>
更多参考文章:
ASP.NET 2.0 中的 Windows 身份验证详解
如何使用 ASP.NET 实用工具加密凭据和会话状态连接字符串