资源简介
在本机可以浏览报表服务器中的报表,部署在iis中访问出现如下问题:为用户“NT AUTHORITY\NETWORK SERVICE”授予的权限不足,无法执行此操作
代码片段和文件信息
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SqlServer.ReportingServices.ReportService2005;
public partial class _Default : System.Web.UI.Page
{
const string m_wsdl = “/ReportService2005.asmx“;
//ReportingWS.ReportingService rs = new ReportingWS.ReportingService();
Microsoft.SqlServer.ReportingServices.ReportService2005.ReportingService2005 rs = new Microsoft.SqlServer.ReportingServices.ReportService2005.ReportingService2005();
///
/// 为Treeview添加节点
///
/// 节点集合
/// 节点对象的路径
private void AddNodes(TreeNodeCollection tnc string nodepath)
{
//将节点路径中包含的对象列举出来
CatalogItem[] items = listChildren(nodepath);
for (int i = 0; i < items.Length; i++)
{
//限制为用户waxdoll\\administrator创建的对象,其中对象又限制为文件夹和报表
if (items[i].CreatedBy == “LIUQIJUN\\Administrator“)
{
if (items[i].Type == ItemTypeEnum.Folder)
tnc.Add(new TreeNode(items[i].Name “folder“ + items[i].Path “folder.gif“ ““ ““));
else if (items[i].Type == ItemTypeEnum.Report)
tnc.Add(new TreeNode(items[i].Name “report“ + items[i].Path “report.gif“ ““ ““));
}
}
items = null;
}
private CatalogItem[] listChildren(string item)
{
CatalogItem [] items = null;
try
{
items = rs.ListChildren(item false);
}
catch (System.Exception ex)
{
}
return items;
}
private void setUserLogion(string reportserverPath)
{
System.Net.NetworkCredential LogonCredentials = new System.Net.NetworkCredential(“Administrator“ “654321“ ““);
rs.Credentials = LogonCredentials;
rs.PreAuthenticate = true;
rs.Url = reportserverPath + m_wsdl;
}
protected void Page_Load(object sender EventArgs e)
{
//设置Web Services客户端身份验证的安全凭据
setUserLogion(“http://192.168.0.100/reportserver“);
if (!this.IsPostBack)
this.AddNodes(this.trvReport.Nodes “/“);
}
protected void trvReport_SelectedNodeChanged(object sender EventArgs e)
{
if (this.trvReport.SelectedNode != null)
{
string strType = this.trvReport.SelectedNode.Value.Substring(0 6);
if (strType == “report“)
{
//选中的节点为报表,则在ReportViewer控件中显示该报表
this.rvReport.Visible = true;
//为ReportViewer显示服务器端报表进行的属性设置
this.rvReport.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 582930 2011-01-17 10:32 RSWS\App_Code\ReportService2005.cs
文件 409 2011-01-17 09:53 RSWS\App_WebReferences\ReportingWS\ReportService.discomap
文件 196342 2011-01-17 09:56 RSWS\App_WebReferences\ReportingWS\ReportService.wsdl
文件 1574 2006-07-29 23:57 RSWS\Default.aspx
文件 3891 2011-01-17 10:48 RSWS\Default.aspx.cs
文件 610 2006-07-29 18:24 RSWS\folder.gif
文件 607 2006-07-29 18:26 RSWS\report.gif
文件 2168 2011-01-17 09:56 RSWS\Web.Config
目录 0 2011-01-17 09:56 RSWS\App_WebReferences\ReportingWS
目录 0 2011-01-17 10:32 RSWS\App_Code
目录 0 2011-01-15 16:46 RSWS\App_Data
目录 0 2011-01-15 16:46 RSWS\App_WebReferences
目录 0 2011-01-17 10:48 RSWS
----------- --------- ---------- ----- ----
788531 13
评论
共有 条评论