how SSRS reports are viewed anonymously
last night, I've been working on how to anonymously access reports and show them to clients. I have studied several ways I have tried to divide into three kinds, which I think are relatively controllable. 1. Modify the SSRS configuration file to prevent him from verifying login user rights
Manipulated article: SSRS Anonymous Logon
Can be completely anonymous access, because our system is related to the customer to do their own reports, so here to block the permissions problem, then this approach for me is not feasible.
Manipulated article: An indirect method for anonymous access
This approach is similar to the third but this is the direct operation of IIS if integrated into the system is also not very scientific.
I'm using a program to disguise the login and get the report.
I think the advantage is that you can control this account only browse permissions, do not destroy anything
What needs to be done is two points:
1. The front desk is still the same, a ScriptManager a ReportViewer
2. And the background code writes like this. The login username and account are stored in the configuration file . Please add it yourself
3. Introduction to this class: Https://msdn.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials.aspx
Public Partial classOne:System.Web.UI.Page {protected voidPage_Load (Objectsender, EventArgs e) { if(!IsPostBack) {ReportParameter para=NewReportParameter ("ReportParameter1","1"); ReportViewer1.ServerReport.ReportServerCredentials=Newmyreportservercredentials (); REPORTVIEWER1.SERVERREPORT.REPORTSERVERURL=NewUri ("HTTP//Report server address/ReportServer"); ReportViewer1.ServerReport.ReportPath="/Report Address"; ReportViewer1.ServerReport.SetParameters (Newreportparameter[] {para}); }}} [Serializable] Public Sealed classMyreportservercredentials:ireportservercredentials { PublicWindowsIdentity Impersonationuser {Get { //Use the default Windows user. Credentials 'll be//provided by the NetworkCredentials property. return NULL; } } PublicICredentials networkcredentials {Get { //Read The user information from the Web. config file. //By reading the information on demand instead of//storing it, the credentials is not being stored in//session, reducing the vulnerable surface area to the//Web. config file, which can is secured with an ACL. //User name stringUserName =Configurationmanager.appsettings ["MyReportViewerUser"]; if(string. IsNullOrEmpty (userName))Throw NewException ("Missing user name from Web. config file"); //Password stringPassword =Configurationmanager.appsettings ["MyReportViewerPassword"]; if(string. IsNullOrEmpty (password))Throw NewException ("Missing password from Web. config file"); //Domain stringDomain =Configurationmanager.appsettings ["MyReportViewerDomain"]; if(string. IsNullOrEmpty (domain))Throw NewException ("Missing domain from Web. config file"); return Newnetworkcredential (userName, password, domain); } } Public BOOLGetformscredentials ( outCookie Authcookie, out stringUserName, out stringPassword, out stringAuthority) {Authcookie=NULL; UserName=NULL; Password=NULL; Authority=NULL; //Not using form credentials return false; } }
You can successfully access the.
How SSRS reports are viewed anonymously