ReportServer

  <table width="100%">
                  <tr>
                    <td align="center" width="100%">
                    <rsweb:ReportViewer ID="reportViewer"  runat="server" Font-Names="Verdana" Width ="100%" 
                        Font-Size="8pt" AsyncRendering="False"  
                        ShowReportBody="True" SizeToReportContent="True">
                    </rsweb:ReportViewer>
                    </td>
                 </tr>

         </table>


  //访问报表凭证用户
        MyReportViewerCredential rp = new MyReportViewerCredential(MyReportViewerCredential.UserName, MyReportViewerCredential.Password, MyReportViewerCredential.domain);
        reportViewer.ServerReport.ReportServerCredentials = rp;
        reportViewer.ProcessingMode = ProcessingMode.Remote;
        reportViewer.ShowToolBar = false; 
        ServerReport serverReport = reportViewer.ServerReport;
        serverReport.ReportServerUrl = new Uri(CommonProc.ReportServerUrl);
        serverReport.ReportPath = "/投资批复费用报表";



  //访问报表凭证用户
        ReportParameter param = new ReportParameter();
        param.Name = "StartDate";
        string strStratDate = PlanDateStartTime.SelectedDate.Trim();
        param.Values.Add(strStratDate);
        ReportParameter param1 = new ReportParameter();
        param1.Name = "EndDate";
        string strEndDate = PlanDateEndTime.SelectedDate.Trim();
        param1.Values.Add(strEndDate);
        reportViewer.ServerReport.SetParameters(new ReportParameter[] { param });
        reportViewer.ServerReport.SetParameters(new ReportParameter[] { param1 });


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Web.SessionState;
using System.Web.Security;
using Microsoft.Reporting.WebForms;
using System.Security.Principal;




/// <summary>
///ReportCertificate 的摘要说明
/// </summary>
public class MyReportViewerCredential:IReportServerCredentials 
{
    //配置报表用户的用户名,密码和域
    public static string UserName = System.Configuration.ConfigurationSettings.AppSettings["UserReportServerName"].ToString();
    public static string Password = System.Configuration.ConfigurationSettings.AppSettings["UserReportServerPassword"].ToString();
    public static string domain = System.Configuration.ConfigurationSettings.AppSettings["Domain"].ToString();


    //私有变量
    private string _username;       //用户名
    private string _password;      //密码
    private string _domain;         //域


    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="username">用户名</param>
    /// <param name="password">密码</param>
    /// <param name="domain">域</param>
    public MyReportViewerCredential(string username, string password, string domain)
    {
        _username = username;
        _password = password;
        _domain = domain;
    }




    /// <summary>
    /// 实现IReportServerCredentials接口的成员属性(ImpersonateUser)
    /// </summary>
    public WindowsIdentity ImpersonationUser
    {
        get { return null; }
    }




    /// <summary>
    /// 实现IReportServerCredentials接口的成员属性(NetworkCedentials)
    /// </summary>
    public System.Net.ICredentials NetworkCredentials
    {
        get { return new NetworkCredential(_username, _password, _domain); }
    }




    /// <summary>
    /// 实现IReportServerCredentials接口的成员方法(GetFormCedentials)
    /// </summary>
    /// <param name="authCookie">Cookie类对象</param>
    /// <param name="user">用户名</param>
    /// <param name="password">密码</param>
    /// <param name="authority">域</param>
    /// <returns></returns>
    public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
    {
        authCookie = null;
        user = _username;
        password = _password;
        authority = _domain;
        return false;
    }
}

 

http://www.cnblogs.com/BlueWoods/archive/2009/04/27/1444311.html

http://blog.csdn.net/hebeijg/article/details/7328932

http://www.microsoft.com/zh-cn/download/details.aspx?id=35747

http://blog.csdn.net/hebeijg/article/details/7328932

http://www.dotblogs.com.tw/yangxinde/archive/2012/11/07/80655.aspx

 

http://www.360doc.com/userhome.aspx?userid=7664736&cid=6#


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值