sábado, 16 de octubre de 2010
Llamar todos los reportes desde una aspx
HTML de la pagina:Necesitaran esta clase:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WebForms;
using System.Net;
using System.Security;
using System.Security.Principal ;
using System.Configuration;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 WindowsIdentity ImpersonationUser {
get {
return null;
}
}
public ICredentials NetworkCredentials {
get {
return new NetworkCredential(_userName, _password, _domain);
}
}
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;
}
}
Código de la pagina, en el evento Load.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string Reporte = "";
Reporte = Request.QueryString["Reporte"].ToString();
rvReportes.ServerReport.ReportServerUrl = new Uri(http://pc/ReportServer);
rvReportes.ServerReport.ReportPath = Reporte;
ReportParameter _param_1 = new ReportParameter("codigo", "123",false);
this.rvReportes.ShowCredentialPrompts = false;
this.rvReportes.ServerReport.ReportServerCredentials = new ReportViewerCredentials("Usuario", "Contraseña", "pc");
this.rvReportes.ServerReport.SetParameters(new ReportParameter[] { _param_1 });
this.rvReportes.ServerReport.Refresh();
}
}
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario