English 中文(简体)
Asp.net Report Viewer impersonation
原标题:Asp.net Report Viewer impersonation

我正在一个协会中使用报告观众的控制。 网上净应用。 申请在配对身份上进行,因此,它有权读/篡改数据库。

但是,对于报告观众的控制,我需要冒充目前滞留在使用者身上。 到目前为止,我只发现有关为整个人确定假冒的信息,以便报告观众也成为冒犯。 或者,有资料说明如何制作发给观众的自己的证书(因此,目前还不是寄给用户的)。

是否有任何人知道如何仅仅为报告编写人而不是整个应用而冒用目前的用户?

问题回答

如果我正确理解你需要执行《国际报告》的话,这里就是一个过去使用的例子。

using System;
using System.Configuration;
using System.Web;
using Microsoft.Reporting.WebForms;
using System.Security.Principal;
using System.Net;

[Serializable]
public sealed class ReportServerNetworkCredentials : IReportServerCredentials
{
#region IReportServerCredentials Members

private string username, password;

public ReportServerNetworkCredentials(string username, string password)
{
    this.username = username;
    this.password = password;
}

public bool GetFormsCredentials(out System.Net.Cookie authCookie, out string userName, out string password, out string authority)
{
    //throw new NotImplementedException(); 
    userName = password = authority = null;

    // The cookie name is specified in the <forms> element in Web.config (.ASPXAUTH by default)
    HttpCookie cookie = HttpContext.Current.Request.Cookies[".ASPXAUTH"];

    if (cookie == null)
    {
        authCookie = null;
        return false;
    }

    Cookie netCookie = new Cookie(cookie.Name, cookie.Value);
    if (cookie.Domain == null)
    {
        netCookie.Domain = HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToUpper();
    }

    netCookie.Expires = cookie.Expires;
    netCookie.Path = cookie.Path;
    netCookie.Secure = cookie.Secure;
    authCookie = netCookie;
    return true;
}

public WindowsIdentity ImpersonationUser
{
    get
    {
        return null;
    }
}

public System.Net.ICredentials NetworkCredentials
{
    get
    {
        return new System.Net.NetworkCredential(this.username, this.password);
    }
}

#endregion
}

之后,在页数上,报告浏览器在您的全权证书上通过等

    ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerNetworkCredentials(username, password);
    ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://youreportserver/ReportServer");
    ReportViewer1.ServerReport.ReportPath = reportPath;
    //etc

这将允许你通过任何用户名称并通过你。 这部名为SSRS 08 /Q08 和idgino 05 的著作也使用了 forms的形式。

希望这一帮助,并且正确理解你的问题。


Edit: Yes just retrieve the current username and password from where ever you are storing them (membership etc) into the and pass into as per my example.

但是,如果你真的需要每个用户的账户,如果你在相片区本身设立账户,则用户名称和通行证必须存在于报告服务器中。 可以通过SSRS网络服务来做到这一点。 如果该网站已经投入使用,你可以很容易地通过所有用户加以利用,并通过SSRS网络服务制作一个账户。

然而,您是否确信每个用户需要一个报告账户? 如果你的原因比伐木多,那么你可以说明自己在评估中的作用。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签