ActiveReports 9 Server User Guide > Samples and Walkthroughs > Walkthroughs > Using the ReportList Web Control |
The Web controls need to be directed to the server used for ActiveReports 9 Server in order to function. In your production application, specify the user name and password based on the current user and store information in the current session to persist these values.
Controls for the Log In page
Control | Text Property |
---|---|
Label | User Name: |
TextBox | ? |
Label | Password: |
TextBox | ? |
Button | Log In |
To get the security token from the user
C# code. Paste INSIDE the button click event. |
Copy Code
|
---|---|
var username = TextBox1.Text; var password = TextBox2.Text; var reportService = new ReportServiceProxy(); HttpContext.Current.Session["arsSecurityToken"] = null; var securityToken = reportService.Login(username, password, null, false); HttpContext.Current.Session["arsSecurityToken"] = securityToken; Server.Transfer("Default2.aspx"); |
To get the security token from the user
C# code. Paste BELOW the other using directives. |
Copy Code
|
---|---|
using ActiveReports.Server.ReportControls.Servicing; |
If you need to add the control to your toolbox, drop down these steps.
You can specify the security token and ActiveReports 9 Server host using code in a Global Application Class.
To import the Servicing namespace
ASP.NET code. Paste on the line BELOW the Application Language line. |
Copy Code
|
---|---|
<%@ Import Namespace="ActiveReports.Server.ReportControls.Servicing" %> |
To create the ResolveRemoteEndpoint event
C# code. Paste in the Global.asax file AFTER the Application_Start event. |
Copy Code
|
---|---|
static void ResolveRemoteEndpoint(RemoteEndpoint remoteEndpoint) { remoteEndpoint.Address = "http://localhost:8080"; remoteEndpoint.SecurityToken = "SecurityToken"; } |
To provide a handler for the event
C# code. Paste INSIDE the Application_Start event. |
Copy Code
|
---|---|
ReportServiceProxy.ResolveRemoteEndpoint += ResolveRemoteEndpoint; |
You can also specify the user name, password, and ActiveReports 9 Server host in your web application's web.config file.
To provide a handler for the event
C# code. Paste BETWEEN the <configSections> and </configSections> tags. |
Copy Code
|
---|---|
<sectionGroup name="activereports.server"> <section name="reportServiceProxy" type="ActiveReports.Server.ReportControls.Configuration.ActiveReportsServerSection, ActiveReports.Server.ReportControls, Version=x.x.xxxx.x, Culture=neutral, PublicKeyToken=d557f2f30a260da2" allowDefinition="Everywhere" /> </sectionGroup> |
To import the Servicing namespace
ASP.NET code. Paste in the web.config file AFTER the </configSections> tag. |
Copy Code
|
---|---|
<activereports.server> <reportServiceProxy remoteReportServicePath="http://localhost:8010/" username="MyUserName" password="MyPassword" /> </activereports.server> |
At run time, the ReportList control retrieves all of the reports from ActiveReports 9 Server, and provides buttons to export each to PDF, Word, and Excel.