how to pass the current user with reportviewer control

Discussion in 'ASP .Net Web Controls' started by Marc, Mar 19, 2009.

  1. Marc

    Marc Guest

    Dear all

    I have a asp.net site using the reportviewer control in remote mode. I can
    display a report with custom credentials by implementing the
    Microsoft.Reporting.WebForms.IReportServerCredentials interface. But there is
    only the possibility to impersonate or to read the user from web.config. What
    I need is that I can pass the remote report server the current windows user
    that is running the asp.net application (this app runs in a intranet context).

    passing no credentials does not seem to be an option because it looks as it
    takes the WindowsIdentity.GetCurrent() user, this is the user that the
    application pool has as identity.

    Any ideas?

    Thanks in advance,

    Marc
     
    Marc, Mar 19, 2009
    #1
    1. Advertising

  2. Hi Marc,

    My name is Allen Chen. It's my pleasure to work with you on this issue.

    My understanding to your question is like this:

    " You have two servers. Server A is a Web Server, Server B runs Reporting
    Service.

    " You've assigned roles to a report. Say domain/UserA can browse the report
    while domain/UserB cannot.

    " domain/UserA and domain/UserB can both access the web page. In the web
    page, you're using a ReportViewer control to show the report.

    " Since domain/UserB has no permission to browse the report you don't want
    to let him view the report. As to domain/UserA, he can view the report
    normally.

    If my understanding is correct, you can try following steps to do so:

    1. Enable Basic Authentication for this web site in IIS and disable other
    authentication.

    2. Add following setting in web.config:
    <system.web>
    <identity impersonate="true"/>

    ...
    </system.web>

    Explanation:

    Actually this is a double hop issue. The user viewing the page needs to
    provide his credential. If the web site is using Windows Authentication
    only the credential is passed to Server A. In that case, impersonation
    cannot delegate the user. If the web site is using Basic Authentication the
    password will be passed to server as well. Then Server A can work as a
    delegation to impersonate the user to communicate with Server B.

    Below are some articles related to this.

    http://blogs.msdn.com/nunos/archive/2004/03/12/88468.aspx

    http://drowningintechnicaldebt.com/blogs/shawnweisfeld/archive/2006/12/06/Th
    e-_1C20_Double-Hop_1D20_-Issue.aspx

    http://weblogs.asp.net/avnerk/archive/2004/09/22/232967.aspx

    Please let me know if it works. If I misunderstood you please correct me
    and clarify your requirement.

    Regards,
    Allen Chen
    Microsoft Online Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 2 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working with a dedicated Microsoft Support Engineer
    by contacting Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Allen Chen [MSFT], Mar 20, 2009
    #2
    1. Advertising

  3. Marc

    Marc Guest

    Dear Allen,

    yes your understanding is correct. Thanks a lot for your help. This solved
    the issue.

    Best regards,

    Marc
     
    Marc, Mar 20, 2009
    #3
  4. You're welcome Marc.

    Thank you for using our Newsgroup Support Service!

    Regards,
    Allen Chen
    Microsoft Online Community Support



    =================================================
    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .
    =================================================
     
    Allen Chen [MSFT], Mar 23, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    4,447
  2. Sevu
    Replies:
    5
    Views:
    8,471
    jhjhj
    Apr 28, 2007
  3. Replies:
    0
    Views:
    415
  4. dbuchanan
    Replies:
    1
    Views:
    287
    Charles Wang [MSFT]
    Jun 20, 2008
  5. Dennis McCarthy

    How to set the user for ReportViewer in local mode?

    Dennis McCarthy, Apr 7, 2009, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    871
    Dennis McCarthy
    Apr 7, 2009
Loading...

Share This Page