MOSS2007自定义aspx页面中使用ReportViewer控件


在assemblies新增

      <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </buildProviders>


修改或新增httpHandlers

<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />


新增 safecontrol

<SafeControl Assembly="Microsoft.ReportViewer.WebForms,Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TypeName="*" Safe="True" />


遇见错误:

The type 'Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' does not implement IReportViewerMessages

在webconfig 中 appsettings 下加入:

<remove key="ReportViewerMessages" />


 

参考:

http://blogs.msdn.com/b/solutions/archive/2007/10/29/installing-sql-reporting-services-and-moss-2007-on-the-same-port-default-80.aspx

http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/228a697f-f391-4b04-8d30-aaca0e91130b/

 

遇见错误:

In remote mode, the Report Viewer control requires session state be enabled or Report Server connection information specified in the config file.

fix:

In your app's web.config make sure that the <pages> tag has the following properties:

<pages enableSessionState="true" enableViewState="true">


and in your <httpModules> section make sure you have the following entry:

<add name="Session"  type="System.Web.SessionState.SessionStateModule"/>


and after the <httpModules> section, include: <sessionState mode="InProc" cookieless="false" timeout="20"/>

 

或者

 

Try using the following

<appSettings>

<add key="ReportViewerServerConnection" value="Microsoft.ReportingServices.UI.WebControlConnection, ReportingServicesWebUserInterface, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />

<add key="ReportViewerTemporaryStorage" value="Microsoft.ReportingServices.UI.ReportViewerTemporaryStorage, ReportingServicesWebUserInterface, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />

<add key="ReportServerUrl" value="your report server url" />

</appSettings>


 

 

参考:

http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/024abdfb-967e-478b-acfe-739f7b7e693a/

http://forums.asp.net/t/1308086.aspx/1

 

遇到错误

That assembly does not allow partially trusted callers

Fix:

修改Web.config

<trust level="Full" originUrl="" />


参考:

http://social.msdn.microsoft.com/Forums/zh-SG/sharepointdevelopment/thread/1e47c5c8-4608-4da0-81d2-ce3d82272420

 

遇到错误

  • The request failed with HTTP status 401: Unauthorized.

Fix:

新建类

    [Serializable]
    public partial class ReportViewerCredentials : IReportServerCredentials
    {
        private string _userName;
        private string _password;
        private string _domain;

        public ReportViewerCredentials(string userName, string password, string domain)
        {
            _userName = userName;
            _password = password;
            _domain = domain;

        }

        public ReportViewerCredentials()
        {
            //_userName = userName;
            //_password = password;
            //_domain = domain;

        }


        public WindowsIdentity ImpersonationUser
        {
            get
            {
                //return null;
                return WindowsIdentity.GetCurrent();
            }
        }

        public ICredentials NetworkCredentials
        {
            get
            {

                return new NetworkCredential(_userName, _password, _domain);
                //return System.Net.CredentialCache.DefaultCredentials;
            }
        }

        public bool GetFormsCredentials(out Cookie authCookie,
                out string userName, out string password,
                out string authority)
        {
            authCookie = null;
            userName = _userName;
            password = _password;
            authority = _domain;

            // Not using form credentials   
            return false;
        }

    }      


 

设定 reportviewer 的credentials

this.ReportViewer1.ServerReport.ReportServerCredentials = new ReportViewerCredentials("name", "password", "domain");


 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值