jskentzos
jskentzos

Reputation: 151

Security Error with Report Viewer Control and RDLC Reports in ASP.NET 4.0

Using ASP.NET 4.0, I'm creating an RDLC stream by instantiating a Microsoft.ReportingServices.RdlObjectModel.Report, setting the Code property, and returning the stream using the RdlSerializer.

Then I'm passing that stream to the ReportViewer like so:

ReportViewer1.LocalReport.LoadReportDefinition(rdlcStream);

If I don't set the Code property, I don't get any errors and the report displays properly, but when I set the Code property for a report that needs custom code, I get the below mentioned 'RequestMinimum' is obsolete error.

An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC40000] 'RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'.’.

This error doesn't occur using the Report Viewer control in a winforms app.

Has anyone seen/resolved this issue?

Upvotes: 14

Views: 17239

Answers (4)

AbsolutelyFreeWeb
AbsolutelyFreeWeb

Reputation: 407

It was a copy and paste error for me. More exactly, I missed a space.

This expression caused the error:

=Fields!CompSalesName.Value& vbcrlf & Fields!Address.Value

While it should have been

=Fields!CompSalesName.Value & vbcrlf & Fields!Address.Value

Upvotes: 0

Baidaly
Baidaly

Reputation: 1849

Another option for those got this error and generate report markup.

Likely one of you <Value> tags starts with "=" sign and if this is not an expression you need to use EvaluationMode="Constant".

Upvotes: 0

MrBassam
MrBassam

Reputation: 359

For me it was the page number in this line
<Value>=Globals!PageNumber + ' of ' + Globals!TotalPages</Value>
When removed everything goes right and i don't know why

Upvotes: 1

Fidel Orozco
Fidel Orozco

Reputation: 1056

I do not know exactly the cause of this error, but in my experience, it was related with a simple copy and past from a expression from one cell to other cell inside the results table, all this after making changes in the layout and groups.

I recommend you delete any expression or formula, verify that your report is executed without any error message, and rewrite down all the expressions and formulas one to one, checking in every formula that your report open correctly.

That worked for me.

Upvotes: 8

Related Questions