Compartilhar via


Launching Report Builder from a Winform or Webform Application in SQL Reporting Services 2005

 

At times, you may need to launch Report Builder from your custom application as either the currently logged in user, or under a different, arbitrary identity. Here's how!

 

Regardless of the technique you use, you're basically going to be hitting the URL https://yourServerName/reportserver/reportbuilder/reportbuilder.application . Most of the samples below are really just doing the "heavy lifting" of creating the necessary process and/or user identity to run Report Builder under:

 

Winform / Current User:

 

Use System.Diagnostics.Process.Start to launch IE and point it to the URL above:

           

System.Diagnostics.Process.Start("IExplore.exe",

"https://localhost/reportserver/reportbuilder/reportbuilder.application");

           

Winform / Other Identity:

 

You'll still be using Process.Start, but you'll also need to utilize some of the new framework 2.0 StartInfo members to specify the username/domain/password, etc. You also will use the new SecureString class to pass your password to StartInfo:

           

ProcessStartInfo startInfo = new ProcessStartInfo(@"c:\program files\internet explorer\iexplore.exe");

startInfo.UserName = "TestUser";

startInfo.Domain = "aDomain";

startInfo.WorkingDirectory = @"c:\program files\internet explorer";

System.Security.SecureString sS = new System.Security.SecureString();

sS.Clear();

sS.AppendChar('P');

sS.AppendChar('a');

sS.AppendChar('s');

sS.AppendChar('s');

sS.AppendChar('W');

sS.AppendChar('o');

sS.AppendChar('r');

sS.AppendChar('d');

sS.AppendChar('1');

sS.AppendChar('2');

sS.AppendChar('3');

startInfo.Password = sS;

startInfo.Arguments = "https://localhost/reportserver/reportbuilder/reportbuilder.application";

startInfo.UseShellExecute = false;

startInfo.LoadUserProfile = true;

Process.Start(startInfo);

           

Another thing on this sample - You need to have LoadUserProfile set to true or Report Builder won't get installed (basically because the ClickOnce cache is located in C:\Documents and Settings\<username>\LocalSettings\Apps...so if you don't have a user profile loaded, there will be nowhere to drop the bits).

           

Webform / Current user:

 

Just use any technique you want to navigate to the https://yourServerName/reportserver/reportbuilder/reportbuilder.application URL

           

 

Webform / Other Identity:

 

 It doesn't appear that this is (easily) doable. If any of you come up with a cool workaround, please let me know and I’ll post it

           

 The basic problem is that regardless of how you launch the process (whether by Process.Start, LoginUserW and CreateProcessAsUser, etc.), it will get launched on the SERVER and will never become interactive. So, you may successfully LAUNCH an instance of IE, but the only place you'll see it is in task manager J There may be a way to locally launch an "impersonated" IE via JavaScript and RunAs, but I didn't have the patience to try and figure it out.

Comments

  • Anonymous
    May 07, 2006
  • Anonymous
    May 29, 2006
    Hi

    Can you please suggest, How I can open 'Report Builder' in Internet Explorer (Not as a seperate application). It should be embedded with IE Page like excel sheet.

    Regards
    Agson Chellakudam
  • Anonymous
    June 06, 2006
    You can't do this -- Sorry.
  • Anonymous
    August 17, 2006
    If I understood your "Winform / Other Identity" sample, that code will launch Report Builder under another NT domain user and prevent Report Builder from prompting you for credentials?

    What if Reporting Services is using Forms Auth? Any way to prevent Report Builder from prompting you for credentials?
  • Anonymous
    August 18, 2006
    Nope. Since Report Builder is a Windows ClickOnce app, the only credentials we can ever "pass" it are Windows Credentials. If you are using forms auth, RB will always prompt for credentials regardless of how you launch it. Sorry!
  • Anonymous
    December 06, 2006
    I've been trying to find a way to have end-users of MS CRM 3.0 gain access to ReportBuilder via a hyperlink in the CRM Reports section. I thought perhaps that this approach would authenticate the user as being the "ReportingGroup" SSRS user that CRM installs, but instead it seems RB checks who the actual Windows user is instead. Consequently, a prompt for Username and Password appears for anyone not specially listed as a system user in SSRS.Based on some previous comments, it appears that there is not work around. But, just to double-check, in order for any user to access the Report Builder, do they need to be either a System Administrator or System User as defined in the Site-Settings of SSRS?Thanks.
  • Anonymous
    December 09, 2006
    The comment has been removed
  • Anonymous
    February 07, 2007
    I have a something similar happening.Report Builder uses my windows account in stead of the one i type in at the prompt.I have given the correct rights on Report Manager. Even when using http://yourServerName/reportserver/reportbuilder/reportbuilder.application it does the same.Could there be something a miss?
  • Anonymous
    February 13, 2007
    All you need to do is to change your iis security setting for the Report Builder folder. Under you Report Server virtual directory select the report builder folder, change this folder's directory security to Basic Authentication and enable Anonymous access. You will be prompted twice now but the security will work peachy.
  • Anonymous
    October 05, 2007
    Can you put this method into an ActiveX control to get around the issue of launching the process on the server.  The only downfalls are that the person has to allow the ActiveX control and be running Windows.  But one can argue that the person should know what they are doing if they want to launch Report Builder and that Report Builder only runs on windows machines anyway.  Tell me if this is possible.Thanks,-Russ
  • Anonymous
    October 07, 2007
    The comment has been removed
  • Anonymous
    November 02, 2007
    PingBack from http://benwhaley.wordpress.com/2007/11/02/links-for-2007-11-02/
  • Anonymous
    June 16, 2008
    I have configured report server for forms authentication and configured it on a internet facing site. for eg. I use the below url instead of localhost to open report manager.http://www.mydomain.com/reportsAs my domain is a asp.net 2.0 website and has a assembly reference for system.data it gives me below error while launching report builder.CS0234: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)
  • Anonymous
    March 11, 2009
    I m facing a prob that, i want selected user should access only selected models of ma report builder. so i need to know how to do that.
  • Anonymous
    May 15, 2009
    I am trying to launch ReportBuilder through my asp.net Application. I would like to know a way to send user credentials while launching the ReportBuilder using url   http://yourServerName/reportserver/reportbuilder/reportbuilder.application I am interested in knowing the solution to the section Webform / Other Identity  in your post. Please post if you had a chance to find the solution. Thanks.