Security in accessing reports on Report Server

Once you deploy reports on to Report Server they can be accessed from any Web application with an established URL. However, I see a scenario when one wants to prevent some users from accessing reports (e.g. a user should be able to view reports presenting only their personal information).

The way around this is to view reports on an aspx page by employing ReportViewer control, which makes it possible to view reports hosted locally or deployed on (in particular remote) ReportServer. I’ve chosen the former approach.

In order to use ReportViewer with reports hosted locally, you need to:

  • change the extension of the report files from RDL to RDLC
  • configure ReportViewer control so it is associated with an appropriate RDLC file and DataSource (you will need to configure it by providing the connection details, specifying the SQL query or stored procedure that will retrieve the data)
  • in code behind for that aspx page (in Page_Load method) you can add some logics that checks if the currently logged user can access the report; if not, you can just throw an Exception
  • if you want to pass parameters to the ReportViewer, you will have to add a few lines to the above mentioned method:
    ReportParameter p = new ReportParameter(PARAM_NAME, PARAM_VALUE);
    reportViewer.LocalReport.SetParameters(new ReportParameter[] { p });
    
Reblog this post [with Zemanta]
Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

Reporting Services - deploying RDL files

In this post I’ll describe how to deploy RDL files using Report Manager (more often http://localhost/Reports or http://localhost/Reports$SQLExpress).
Note: This description applies to the situation where Microsoft SQL Server is used.

  1. Go to Report Manager
  2. Too keep all clean, you can create a folder in which you will keep all your reports
  3. Create the data source, if not yet existing, by selecting the New Data Source link.
    • Specify Microsoft SQL Server as the Connection Type.
    • Specify the database Connection String as follows:
      data source=[Name of database server SQL Instance];initial catalog=[Name of database]
    • Connect Using the Credentials stored securely in the report server and specify the user name and password used to connect to SQL Server instance installed in the database server.
      Datasource configuration

      Datasource configuration

  4. Upload the report by selecting the Upload File link and navigate to the RDL file stored in the system.
  5. Using Show Details view, edit the uploaded reports by selecting the Edit link.
  6. Under the Data source link, assign the previously created shared datasource as the source of data for the report.

    Note: The “Apply” button needs to be selected to apply the changes made for the report.

Zemanta Pixie
Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

Reporting Services - problem with passing parameters directly in the URL

In one of the projects I had to create reports (using Reporting Services) that then should be accessible from the application I’ve been developing.

As the first thing I created the reports themselves (RDL files), deployed them using the Report Manager (more often http://localhost/Reports or http://localhost/Reports$SQLExpress), and configured so I could access them. However, each time I accessed a report I had to provide the input parameters which were used by the stored procedure in order to deliver appropriate amount of information. I wanted to avoid that by passing the parameters somwhowin the URL.

Google came with two interesting articles: Using SQL reporting services in an asp.net application with some notes on report parameters, and Passing parameters and other options directly through a URL in Reporting Services. I followed the instructions but failed. In fact I got stuck making minor changes to the URL, checking the configuration, googling further…

It was only my friend who spotted that I tried to pass the parameters to the Report Manager using URL similar to http://localhost/Reports/Pages/Report.aspx?ItemPath=XXX&rs:Command=Render&ParamName=ParamValue. Instead I should use the Report Server, so link looking this way: http://localhost/ReportServer/?XXX&rc:parameters=false&rs:Command=Render&ParamName=ParamValue.

Note: Please remember there are two services: Report Manager and Report Server and understand the difference between them. This way you won’t loose presous time, as I did :)

Zemanta Pixie
Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

Reporting Services - “Your browser does not support scripts or has been configured not to allow scripts.”

When I run a report in the Report Manager using Internet Explorer (I had this issue on IE7) I got the following error:

Your browser does not support scripts or has been configured not to allow scripts./blockquote>

Should you get it as well follow the instruction below:

  • go to (from its menu) Tools/Internet Options
  • go to Security tab
  • select Trusted zone from the list of available zones
  • click Sites button
  • in new window provide the URL of the Reports Manager (e.g. http://MACHINE_NAME/*); if you are running Reports Manager not on the default port, provide the port number as well

That helped me.
Should you have any problems with it, let me know.

Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

Firefox Download Day

Firefox 3: Recorde Mundial no GuinnessImage by leorolim via Flickr

Quite late but anyway…

From 18:16 UTC on June 17, 2008 to 18:16 UTC on June 18, 2008, 8,002,530 people downloaded Firefox, which resulted in getting Guinness World Record for the most software downloaded in 24 hours. Please look there to see the map of Firefox downloads worldwide and read more about the Guiness World Record.

I’m proud of taking part in that event! As a thank-you I’ve obtained the special certificate (in Polish):

Certificate of getting Guinness World Record

Zemanta Pixie
Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

FCKEditor - how to access the HTML content from JavaScript?

Imagine you have a form in which you use FCKEditor as an inline HTML editor. So, inside script tag you have this:

var oFCKeditor = new FCKeditor('body_html');
oFCKeditor.BasePath = "A_PATH_TO_FCKEDITOR";
oFCKeditor.ToolbarSet = "Basic";
oFCKeditor.Create();

As you know, this creates a textarea with id set to ‘body_html’ and make it look like an inline HTML editor.

Going forward, you would like to receive the HTML code that represents the content of this textarea, and that you want to do this in JavaScript. In order to do that you need to follow FCKEditor API, so do somethink like this:

FCKeditorAPI.GetInstance('body_html').GetHTML(true);

Maybe it’s obvious but it took my a while to find out how to do this…

Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

IIS on Windows XP: There are too many people accessing the Web site at this time.

I started getting this error when I accessed pages hosted on IIS installed on my machine (I’m running Windows XP):

The page cannot be displayed
There are too many people accessing the Web site at this time.

——————————————————————————–

Please try the following:

Click the Refresh button, or try again later.

Open the localhost home page, and then look for links to the information you want.
HTTP 403.9 - Access Forbidden: Too many users are connected
Internet Information Services

——————————————————————————–

Technical Information (for support personnel)

Background:
This error can occur if the Web server is busy and cannot process your request due to heavy traffic.

More information:
Microsoft Support

The wierd thing was I was getting that error on Opera and IE, but everything was fine on Firefox.

Solution

My friend suggested the following:

  1. go to IIS Manager
  2. right click on ‘Default Web Site’ (under YOUR_MACHINE_NAME/Web Sites/) and choose properties
  3. change ‘Connection Timeout’ value to 10 seconds
  4. uncheck ‘HTTP Keep-Alives Enabled’
  5. save the changes
Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

My Master’s Thesis

It was almost a year ago when I graduated from Gdansk University of Technology, major Distributed Applications and Internet Systems. The title of my Master’s Thesis was “Social Semantic Information Sources for eLearning”. All in all, I forgot to present the thesis… So, here it goes :)

Master's Thesis.

You can also download the thesis from Library@DERI.Galway. Apart from that, you can find there more papers of mine on Library@DERI.Galway.

Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

Microsoft JScript runtime error: Object doesn’t support this property or method.

Yesterday I spent two hours analyzing this issue, which of course I had only with Internet Explorer…

As the background: I wrote a library that would make a table sortable and paginable. I decided to use prototype.js and script.aculo.us. I tried to test the result not only in Firefox which I use by default, but then I simply forgot… Then, when I run the page I got the error:

Microsoft JScript runtime error: Object doesn’t support this property or method.

At the end of the day, (after cutting JavaScript files into slices) I found the reason. All because I created HTML elements like follows (this example uses Builder of script.aculo.us):

$(this._sPaginationSecId).appendChild(Builder.node('span', { class: 'disabled' }, '<'));

If you look at that closer, you will find out that class is not put inside apostrophes (’).

Important!
Be careful with defining properties like href and class with Builder.node() (of script.aculo.us) and new Element() (of prototype).

Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail

JavaScript: what if nested ‘this’ doesn’t work?

Note: Examples used in that post require usage of prototype.js.

Imagine you have a JavaScript class with some features related to the current view. One of the method in that class is supposed to add an observer on all anchors marked with class “delete”. That observer is also defined in this class. In other words, you have a number of “delete” links (similar to one below) and you want to register an event handler that would fire when either of those links is clicked.

The link exmple:
<a href="#" class="delete">delete</a>

Let’s assume the aforementioned methods are defined as follows:

registerDeleteHandlers: function() {
	$$('a.delete').each(function(anchor) {
		anchor.observe('click', this.deleteItem);
	});
},

deleteItem: function(event) {
	...
}

As you would discover the handler wouldn’t be registered… It’s because this inside the inner function (which really registers the observer) is binded to a different context!

Simple solution (smarter)

Define the registerDeleteHandlers function as follows:

registerDeleteHandlers: function() {
	$$('a.delete').each(function(anchor) {
		anchor.observe('click', this.deleteItem);
	}.bind(this));
}

Another way around

Inside the registerDeleteHandlers function you can bind this to a temporary variable and use it in the inner function instead of this. So the registerDeleteHandlers function would look like that:

registerDeleteHandlers: function() {
	var self = this;
	$$('a.delete').each(function(anchor) {
		anchor.observe('click', self.deleteItem);
	});
}
Share and Enjoy:
  • del.icio.us
  • Digg
  • Technorati
  • Reddit
  • StumbleUpon
  • description
  • Wykop
  • Gwar
  • e-mail