如何使用<identity impersonate="true"/>
2012-07-08 15:04
591 查看
前两天在VS2008下做个项目,用到了excel组件没有问题,但当把该项目在IIS下配置后,用浏览器浏览结果则不正确,网上说用dcom组件配置下,可是我按照要求配了,结果还是不对。
后来找到一个方法好用了。
Web.config中加了一句话:“<identity impersonate="true" userName="操作系统用户" password="用户密码"/>”,浏览…,结果正确,后来我就在网上查了下这句话的作用,MSDN是这样说的:
1、模拟 IIS 验证的帐户或用户
后来找到一个方法好用了。
Web.config中加了一句话:“<identity impersonate="true" userName="操作系统用户" password="用户密码"/>”,浏览…,结果正确,后来我就在网上查了下这句话的作用,MSDN是这样说的:
1、模拟 IIS 验证的帐户或用户
若要在收到 ASP.NET 应用程序中每个页的每个请求时模拟 Microsoft Internet 信息服务 (IIS) 身份验证用户,必须在此应用程序的 Web.config 文件中包含 <identity> 标记,并将 impersonate 属性设置为 true
2、为 ASP.NET 应用程序的所有请求模拟特定用户
若要为 ASP.NET 应用程序的所有页面上的所有请求模拟特定用户,可以在该应用程序的 Web.config 文件的 <identity> 标记中指定 userName 和 password 属性。例如:
<identity impersonate="true" userName="accountname" password="password" />
相关文章推荐
- 如何使用<identity impersonate="true"/>
- Xcode如何使用<>来引用静态库
- 回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true"
- <!-- <s:action name="navAllFront" namespace="/nav" executeResult="true" flush="false"></s:action>
- ASP.NET中使用<script runat="server">
- <supports-screens android:anyDensity="true" />
- 如何在onclick事件中使用<c:out>标签传参
- 添加 <identity impersonate="true" userName="username" password="password"/>,解决问题!
- <一>Ioc控制反转——手把手教学:如何配置并使用单元测试一个spring框架(附源码)
- "<>"、"!="、"not in"、"exsits"和"not exists"的使用规范
- 如何在前台使用<%#eval( )%> 传递多个参数
- spring3 jsp页面使用<form:form modelAttribute="xxxx" action="xxxx">报错,附连接数据库的spring MVC annotation 案例
- <div style="display:none">中更改的内容使用js无法获取
- <compilation debug="true" targetFramework="4.0">的解决
- 回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true"
- 如果应用程序正在通过 <identity impersonate="true"/> 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。
- 只有在配置文件或 Page 指令中将 enableSessionState 设置为 true 时,才能使用会话状态。还请确保在应用程序配置的 <configuration>
- 回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/>
- <jsp:invoke fragment=""/>的理解和使用
- 使用<input type="file">实现文件上传