• 如何在ASP.NET程序中使用报表查看器控件并传递用户凭据


    第一步,需要创建一个自定义的Credentails类型

    public class CustomReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials
    {  

        // local variable for network credential.
        private string _UserName;
        private string _PassWord;
        private string _DomainName;
        public CustomReportCredentials(string UserName, string PassWord, string DomainName)
        { 
            _UserName = UserName;
            _PassWord = PassWord;
            _DomainName = DomainName;
        }
        public WindowsIdentity ImpersonationUser
        {
            get
            {
                return null;  // not use ImpersonationUser
            }
        }
        public ICredentials NetworkCredentials
        {
            get
            { 

               // use NetworkCredentials
                return new NetworkCredential(_UserName,_PassWord,_DomainName);
            }
        }
        public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
        { 

           // not use FormsCredentials unless you have implements a custom autentication.
            authCookie = null;
            user = password = authority = null;
            return false;
        }

    }

    第二步,在代码中这样编写

    IReportServerCredentials irsc = new CustomReportCredentials(userid,password, domain);
    ReportViewer1.ServerReport.ReportServerCredentials = irsc;

  • 相关阅读:
    django 项目 crm 关于展示表的细节
    djagngo crm 项目 展示页面 和分页
    django项目 crm登录 注册
    django项目 crm表结构一些常用的字段
    django认证 auth
    django form组件
    json和ajax技术
    VS 2013编译64位版本QT 4.8.6及使用cmake为依赖QT生成VS项目时Could NOT find Qt4
    使用国内pypi源来安装python包
    [转]ubuntu 下无法启动chrome
  • 原文地址:https://www.cnblogs.com/chenxizhang/p/1486308.html
Copyright © 2020-2023  润新知