SSRS 报表 如何匿名查看

昨晚一直研究怎么能匿名访问报表然后给客户看呢?

研究了好几种办法

我试过的分为三种,其中推荐我认为相对可控一点。

.修改SSRS配置文件来禁止他验证登陆用户权限
 操作过的文章:SSRS匿名登录
 可以完全匿名访问,因为我们系统是涉及到客户要自己做报表的,所以这里屏蔽了权限问题,那么这种办法对我来说是不可行的。
2.修改IIS配置
 操作过的文章:匿名访问的一个间接方法
 这种办法和第三种类似但是这个是直接操作IIS的如果集成到系统中也不是很科学。

我用的是通过程序伪装登陆之后获得报表

我觉得这样的好处是,可以控制此账户只有浏览的权限,并不破坏任何东西

需要做的就是两点:

1.前台还是一样,一个ScriptManager 一个ReportViewer

2.而后台代码这样写。其中把登陆用户名和账户都存到存到配置文件当中。请自行添加

3.这个类的介绍:https://msdn.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials.aspx

public partial class One : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportParameter para = new ReportParameter("ReportParameter1", "");
ReportViewer1.ServerReport.ReportServerCredentials = new MyReportServerCredentials();
ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://报表服务器地址/reportserver");
ReportViewer1.ServerReport.ReportPath = "/报表地址";
ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { para });
} } }
[Serializable]
public sealed class MyReportServerCredentials : IReportServerCredentials
{
public WindowsIdentity ImpersonationUser
{
get
{
// Use the default Windows user. Credentials will be
// provided by the NetworkCredentials property.
return null;
}
} public ICredentials NetworkCredentials
{
get
{
// Read the user information from the Web.config file.
// By reading the information on demand instead of
// storing it, the credentials will not be stored in
// session, reducing the vulnerable surface area to the
// Web.config file, which can be secured with an ACL. // User name
string userName =
ConfigurationManager.AppSettings
["myReportViewerUser"]; if (string.IsNullOrEmpty(userName))
throw new Exception(
"Missing user name from web.config file"); // Password
string password =
ConfigurationManager.AppSettings
["MyReportViewerPassword"]; if (string.IsNullOrEmpty(password))
throw new Exception(
"Missing password from web.config file"); // Domain
string domain =
ConfigurationManager.AppSettings
["MyReportViewerDomain"]; if (string.IsNullOrEmpty(domain))
throw new Exception(
"Missing domain from web.config file"); return new NetworkCredential(userName, password, domain);
}
} public bool GetFormsCredentials(out Cookie authCookie,
out string userName, out string password,
out string authority)
{
authCookie = null;
userName = null;
password = null;
authority = null; // Not using form credentials
return false;
}
}

可以成功访问了。。

SSRS 报表 如何匿名查看的更多相关文章

  1. 玩转SSRS第九篇---匿名访问的一个间接方法

    SSRS是一个功能丰富的报表平台,我们可以在这个平台上实现各种不同需求的报表应用,所以这个平台也吸引了很多.net框架之外的技术,希望能在应用中引入SSRS的报表,比如JSP或者PHP页面,这个时候系 ...

  2. [译]SSRS 报表版本控制

    问题 如今商务智能应用广泛,对我们的商业愈加重要. 对新报表和的各种需求不断攀升. 自 SQL Server 2008 R2的 Reporting Services (SSRS) 开始,微软视图为减轻 ...

  3. SSRS 报表 递归列表

    SSRS 报表 递归列表 .需要数据集合中两个必备字段 ID PID 1.添加数据集合,在图上标记的地方点击右键添加数据集合,根据需求自己编写 2.点击插入选项卡 中的 矩阵  有两种方式 一种是 矩 ...

  4. Dynamics AX 2012 R2 SSRS报表在VS2010中预览没有数据

    今天,Reinhard 在VS中制作SSRS报表,预览的时候发现显示不出数据. 仔细检查了数据处理环节和临时表里的数据,都发现没有问题. 用同事的账号登陆同样的开发环境,发现他的账号可以在VS中预览到 ...

  5. [AX2012 R3]在SSRS报表中使用QR二维码

    AX2012是自带生成QR二维码的类,可以很方便的用在SSRS报表中,下面演示如何在RDP的报表中使用二维码,首先从定义临时表开始: 字段URL是要用于二维码的字符串,QrCode是container ...

  6. SQL Server 2005中设置Reporting Services发布web报表的匿名访问

    原文:SQL Server 2005中设置Reporting Services发布web报表的匿名访问 一位朋友提出个问题:集成到SQL Server 2005中的Reporting Services ...

  7. SSRS报表服务随笔(rdl报表服务)-创建一个简单的报表

    这段时间一直在敲rdl报表,在国内的不这么留在,在国外的话,还是挺流行的,国内的话,这方面的资料很少很少,也踏过不少坑 先从SSRS了解起,SSRS全称 SQL Server Reporting Se ...

  8. [AX2012]在SSRS报表中获取从Menuitem传入的记录

    在较早版本的AX中我们运行一个报表时会用到类RunBaseReport,从它扩展一个子类,再由它运行报表,一个典型的Axapta3中的例子: class ReportProdInfo extends ...

  9. SSRS 报表 如何加参数

    SSRS 报表 如何加参数 连接上以后出现一个问题 就是给报表加上参数以后报表不断刷新,跟上次那个报表刷新是同样的问题.那么下面我们来解决一下. 1. 这是给报表添加默认参数进入页面后就不断的刷新刷新 ...

随机推荐

  1. UVA 11294 - Wedding(Two-Set)

    UVA 11294 - Wedding 题目链接 题意:有n对夫妻,0号是公主.如今有一些通奸关系(男男,女女也是可能的)然后要求人分配在两側.夫妻不能坐同一側.而且公主对面一側不能有两个同奸的人,问 ...

  2. VS 2013+Qt 5.4.1

    Qt应用能够用Qt Creator开发,也能够使用Visual Studio. 我之前一直用Qt Creator.也始终认为这是最好的选择.只是有人偏爱Visual Studio,我也由于工作须要,要 ...

  3. 反射 + 配置文件 实现IOC容器

    IOC实现: IOC容器我们只停留在知道上是不行的,我们要动手做印象对更深刻,那么我给大家看一个代码.看看代码中IOC容器的实现. 代码实现: 创建一个类库: 解决方式的类库建立: 创建一个实体类:U ...

  4. 如何用Android studio生成正式签名的APK文件

    必须签名之后才可以发布到app商店中. 平时的调试的app都有默认的签名. 下面是生成带签名的APK的步骤: 1. Build 选择 Generate Signed APK 2. 弹出框,第一次选择C ...

  5. 性能监控之监控SQL语句

    分析表 analyze table tablename compute statistics for all indexes; analyze table tablename compute stat ...

  6. Codeforces 667D World Tour 最短路

    链接 Codeforces 667D World Tour 题意 给你一个有向稀疏图,3000个点,5000条边. 问选出4个点A,B,C,D 使得 A-B, B-C, C-D 的最短路之和最大. 思 ...

  7. Git 环境安装

    本文环境: 操作系统:Windows XP SP3 Git客户端:TortoiseGit-1.8.14.0-32bit 一.安装Git客户端 全部安装均采用默认! 1. 安装支撑软件 msysgit: ...

  8. SP1487 PT07J - Query on a tree III 主席树+dfs序

    Code: #include<iostream> #include<cstdio> #include<algorithm> #include<string&g ...

  9. mysql中如何查看某个数据库或表占用的磁盘空间

    查整个库的状态:select concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,          concat(tru ...

  10. UVA-12083 Guardian of Decency 二分图 最大独立集

    题目链接:https://cn.vjudge.net/problem/UVA-12083 题意 学校组织去郊游,选择最多人数,使得任意两个人之间不能谈恋爱 不恋爱条件是高差大于40.同性.喜欢的音乐风 ...