Showing posts with label request. Show all posts
Showing posts with label request. Show all posts

Sunday, February 19, 2012

Can reports access session object and/or variables?

We are using SQL Reporting Services 2000.
We need the reports to be able to access a session variable or the request
object's server variables. How can we do this?Thank you for posting.
As for the SQL Server reporting service, the report components and controls
are well encapsulated to provide data centric processing. The underlying
ASP.NET application pipeline or components are hidden from the report
builder or developer, so we can not directly access session object in SQL
RS's report.
BTW, if you're programmtically request the SSRS report in ASP.NET web
application (through webservice), you can consider put the session state
manipulation code in ASP.NET application layer.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Thanks for responding, Steven.
As an alternative to session, do you know if there is a way to do a global
variable for several reports to access? Our reports need to access a URL
that is different in the dev/test/production environments. One other person
suggested pulling this URL from a dataset, which is a decent workaround, but
it just seems like there should be a way to do a global variable in report
manager (we are using SRS2000).
"Steven Cheng[MSFT]" wrote:
> Thank you for posting.
> As for the SQL Server reporting service, the report components and controls
> are well encapsulated to provide data centric processing. The underlying
> ASP.NET application pipeline or components are hidden from the report
> builder or developer, so we can not directly access session object in SQL
> RS's report.
> BTW, if you're programmtically request the SSRS report in ASP.NET web
> application (through webservice), you can consider put the session state
> manipulation code in ASP.NET application layer.
> Regards,
> Steven Cheng
> Microsoft Online Community Support
>
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>|||Thanks for your response,
So far I haven't found any other particular storage like the Session state
in normal web application. I also think the suggesion on using database to
store such data is reasonable. And you can consider defining a shared
datasource for such database table so that make the shared data accessing
more reusable among your report projects.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Thursday, February 16, 2012

Can report services use Request.QueryString("varName") for record selection?

I know the parameters are available, but let's say if I've got a variable in a request.QueryString() function I want to use from a page which links to the report, is it possible for the record selection to be filtered by the Request.QueryString() variable?You need to pass the page parameters into as report parameter name / value pairs. We do not provide you the raw page querystring in the report (as the report execution isn't even guaranteed to come from a web page).

Can report access ServerVariables?

How can a report access the Request.ServerVariables collection? What we are
trying to do is customize a piece of the report (through an if statement)
depending on one of the values in the ServerVariables collection, and if we
create a custom assembly, it doesn't have access to the Request object.Hi David,
In the Report properties window, under the Reference tab, you should add
a reference to the System.Web namespace, the HttpRequest class is located in
there, and you should be able to call it in a function (declared in the Code
tab).
I hope this helps,
Daniel.
"David" wrote:
> How can a report access the Request.ServerVariables collection? What we are
> trying to do is customize a piece of the report (through an if statement)
> depending on one of the values in the ServerVariables collection, and if we
> create a custom assembly, it doesn't have access to the Request object.|||Thanks for the info, Daniel. I am able to reference the HttpRequest class in
a function in the Code tab after adding a reference to the System.Web
namespace. However, I don't think it is properly accessing the current
Request object. When I try the code block below, it gives #Error.
Function GetServerName() As String
Return System.Web.HttpContext.Current.Request.ServerVariable("server_name")
End Function
And then in the report, say =Code.GetServerName()
Please let me know if you have luck with this, or can give more suggestions.
Thanks!
"daniel_xi" wrote:
> Hi David,
> In the Report properties window, under the Reference tab, you should add
> a reference to the System.Web namespace, the HttpRequest class is located in
> there, and you should be able to call it in a function (declared in the Code
> tab).
> I hope this helps,
> Daniel.
> "David" wrote:
> > How can a report access the Request.ServerVariables collection? What we are
> > trying to do is customize a piece of the report (through an if statement)
> > depending on one of the values in the ServerVariables collection, and if we
> > create a custom assembly, it doesn't have access to the Request object.|||Hi David,
It seems to be a permisison related issue. You may try to add the following
code to see if it helps
System.Security.PermissionSet ps = new System.Security.PermissionSet
(System.Security.Permissions.PermissionState.Unrestricted);
ps.Assert();
Also, please catch if there is any exception whening get context
Try
context = System.Web.HttpContext.Current
Catch ex As Exception
Return "Error getting context: " & ex.Message
End Try
Please refer to the following article for details:
How to grant permissions to a custom assembly that is referenced in a
report in Reporting Services
http://support.microsoft.com/?id=842419
Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
>Thread-Topic: Can report access ServerVariables?
>thread-index: AcX1zJXxC9lyeoNdTYiBdeCxoHUxWQ==>X-WBNR-Posting-Host: 162.111.235.36
>From: "=?Utf-8?B?RGF2aWQ=?=" <dilworth@.newsgroups.nospam>
>References: <7D537990-C70F-4BBB-BE01-9AF32AE78CDB@.microsoft.com>
<4EDA9E61-C953-4A7E-9F18-EE0A8611E3E8@.microsoft.com>
>Subject: RE: Can report access ServerVariables?
>Date: Wed, 30 Nov 2005 08:39:08 -0800
>Lines: 33
>Message-ID: <6CEA2685-E588-4176-8F58-796AE68661EC@.microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.sqlserver.reportingsvcs
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.reportingsvcs:64184
>X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
>Thanks for the info, Daniel. I am able to reference the HttpRequest class
in
>a function in the Code tab after adding a reference to the System.Web
>namespace. However, I don't think it is properly accessing the current
>Request object. When I try the code block below, it gives #Error.
>Function GetServerName() As String
> Return
System.Web.HttpContext.Current.Request.ServerVariable("server_name")
>End Function
>And then in the report, say =Code.GetServerName()
>Please let me know if you have luck with this, or can give more
suggestions.
> Thanks!
>"daniel_xi" wrote:
>> Hi David,
>> In the Report properties window, under the Reference tab, you should
add
>> a reference to the System.Web namespace, the HttpRequest class is
located in
>> there, and you should be able to call it in a function (declared in the
Code
>> tab).
>> I hope this helps,
>> Daniel.
>> "David" wrote:
>> > How can a report access the Request.ServerVariables collection? What
we are
>> > trying to do is customize a piece of the report (through an if
statement)
>> > depending on one of the values in the ServerVariables collection, and
if we
>> > create a custom assembly, it doesn't have access to the Request object.
>|||Hi Peter,
I don't understand: David was referring to the System.Web.dll file, which
is already placed in the appropriate folders; this is not a custom DLL, it
comes with the .NET framework, is there still a permissions issue with this
system DLL?
I added a reference to it in the Report properties' Reference tab area,
but still could not make it work, using David's example listed below, by
calling the class property from a function in the Code tab.
Daniel.
"Peter Yang [MSFT]" wrote:
> Hi David,
> It seems to be a permisison related issue. You may try to add the following
> code to see if it helps
> System.Security.PermissionSet ps = new System.Security.PermissionSet
> (System.Security.Permissions.PermissionState.Unrestricted);
> ps.Assert();
> Also, please catch if there is any exception whening get context
> Try
> context = System.Web.HttpContext.Current
> Catch ex As Exception
> Return "Error getting context: " & ex.Message
> End Try
> Please refer to the following article for details:
> How to grant permissions to a custom assembly that is referenced in a
> report in Reporting Services
> http://support.microsoft.com/?id=842419
> Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> --
> >Thread-Topic: Can report access ServerVariables?
> >thread-index: AcX1zJXxC9lyeoNdTYiBdeCxoHUxWQ==> >X-WBNR-Posting-Host: 162.111.235.36
> >From: "=?Utf-8?B?RGF2aWQ=?=" <dilworth@.newsgroups.nospam>
> >References: <7D537990-C70F-4BBB-BE01-9AF32AE78CDB@.microsoft.com>
> <4EDA9E61-C953-4A7E-9F18-EE0A8611E3E8@.microsoft.com>
> >Subject: RE: Can report access ServerVariables?
> >Date: Wed, 30 Nov 2005 08:39:08 -0800
> >Lines: 33
> >Message-ID: <6CEA2685-E588-4176-8F58-796AE68661EC@.microsoft.com>
> >MIME-Version: 1.0
> >Content-Type: text/plain;
> > charset="Utf-8"
> >Content-Transfer-Encoding: 7bit
> >X-Newsreader: Microsoft CDO for Windows 2000
> >Content-Class: urn:content-classes:message
> >Importance: normal
> >Priority: normal
> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> >Newsgroups: microsoft.public.sqlserver.reportingsvcs
> >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
> >Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
> >Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.reportingsvcs:64184
> >X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
> >
> >Thanks for the info, Daniel. I am able to reference the HttpRequest class
> in
> >a function in the Code tab after adding a reference to the System.Web
> >namespace. However, I don't think it is properly accessing the current
> >Request object. When I try the code block below, it gives #Error.
> >
> >Function GetServerName() As String
> > Return
> System.Web.HttpContext.Current.Request.ServerVariable("server_name")
> >End Function
> >
> >And then in the report, say =Code.GetServerName()
> >
> >Please let me know if you have luck with this, or can give more
> suggestions.
> > Thanks!
> >
> >"daniel_xi" wrote:
> >
> >> Hi David,
> >>
> >> In the Report properties window, under the Reference tab, you should
> add
> >> a reference to the System.Web namespace, the HttpRequest class is
> located in
> >> there, and you should be able to call it in a function (declared in the
> Code
> >> tab).
> >>
> >> I hope this helps,
> >>
> >> Daniel.
> >>
> >> "David" wrote:
> >>
> >> > How can a report access the Request.ServerVariables collection? What
> we are
> >> > trying to do is customize a piece of the report (through an if
> statement)
> >> > depending on one of the values in the ServerVariables collection, and
> if we
> >> > create a custom assembly, it doesn't have access to the Request object.
> >
>|||Hello Daniel,
Based on my test, it seems we cannot get proper current context inside
assmbly code. I used the following code in the custom assembly but I
received "context is nothing" in the test report.
Public Shared Function GetServerName() As String
Dim ps As System.Security.PermissionSet
Dim context As System.Web.HttpContext
ps = New
System.Security.PermissionSet(System.Security.Permissions.PermissionState.Un
restricted)
ps.Assert()
Try
context = System.Web.HttpContext.Current
Catch ex As Exception
Return "error getting context" & ex.Message
End Try
'Return context.Request.ServerVariables("server_name")
If context Is Nothing Then
Return "context is nothing"
End If
Return "context is ok"
End Function
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
>Thread-Topic: Can report access ServerVariables?
>thread-index: AcX3S1g4qkdWUx/PTQi9qrssfMbMGA==>X-WBNR-Posting-Host: 68.236.108.222
>From: =?Utf-8?B?ZGFuaWVsX3hp?= <danielxi@.discussions.microsoft.com>
>References: <7D537990-C70F-4BBB-BE01-9AF32AE78CDB@.microsoft.com>
<4EDA9E61-C953-4A7E-9F18-EE0A8611E3E8@.microsoft.com>
<6CEA2685-E588-4176-8F58-796AE68661EC@.microsoft.com>
<tCWA8oy9FHA.4000@.TK2MSFTNGXA02.phx.gbl>
>Subject: RE: Can report access ServerVariables?
>Date: Fri, 2 Dec 2005 06:19:02 -0800
>Lines: 125
>Message-ID: <51926A21-18BC-4DBE-B495-B57C2D2E87A2@.microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.sqlserver.reportingsvcs
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.sqlserver.reportingsvcs:64320
>X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
>Hi Peter,
> I don't understand: David was referring to the System.Web.dll file,
which
>is already placed in the appropriate folders; this is not a custom DLL, it
>comes with the .NET framework, is there still a permissions issue with
this
>system DLL?
> I added a reference to it in the Report properties' Reference tab area,
>but still could not make it work, using David's example listed below, by
>calling the class property from a function in the Code tab.
> Daniel.
>
>"Peter Yang [MSFT]" wrote:
>> Hi David,
>> It seems to be a permisison related issue. You may try to add the
following
>> code to see if it helps
>> System.Security.PermissionSet ps = new System.Security.PermissionSet
>> (System.Security.Permissions.PermissionState.Unrestricted);
>> ps.Assert();
>> Also, please catch if there is any exception whening get context
>> Try
>> context = System.Web.HttpContext.Current
>> Catch ex As Exception
>> Return "Error getting context: " & ex.Message
>> End Try
>> Please refer to the following article for details:
>> How to grant permissions to a custom assembly that is referenced in a
>> report in Reporting Services
>> http://support.microsoft.com/?id=842419
>> Regards,
>> Peter Yang
>> MCSE2000/2003, MCSA, MCDBA
>> Microsoft Online Partner Support
>> When responding to posts, please "Reply to Group" via your newsreader so
>> that others may learn and benefit from your issue.
>> =====================================================>>
>> This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
>> --
>> >Thread-Topic: Can report access ServerVariables?
>> >thread-index: AcX1zJXxC9lyeoNdTYiBdeCxoHUxWQ==>> >X-WBNR-Posting-Host: 162.111.235.36
>> >From: "=?Utf-8?B?RGF2aWQ=?=" <dilworth@.newsgroups.nospam>
>> >References: <7D537990-C70F-4BBB-BE01-9AF32AE78CDB@.microsoft.com>
>> <4EDA9E61-C953-4A7E-9F18-EE0A8611E3E8@.microsoft.com>
>> >Subject: RE: Can report access ServerVariables?
>> >Date: Wed, 30 Nov 2005 08:39:08 -0800
>> >Lines: 33
>> >Message-ID: <6CEA2685-E588-4176-8F58-796AE68661EC@.microsoft.com>
>> >MIME-Version: 1.0
>> >Content-Type: text/plain;
>> > charset="Utf-8"
>> >Content-Transfer-Encoding: 7bit
>> >X-Newsreader: Microsoft CDO for Windows 2000
>> >Content-Class: urn:content-classes:message
>> >Importance: normal
>> >Priority: normal
>> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>> >Newsgroups: microsoft.public.sqlserver.reportingsvcs
>> >NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>> >Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
>> >Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.sqlserver.reportingsvcs:64184
>> >X-Tomcat-NG: microsoft.public.sqlserver.reportingsvcs
>> >
>> >Thanks for the info, Daniel. I am able to reference the HttpRequest
class
>> in
>> >a function in the Code tab after adding a reference to the System.Web
>> >namespace. However, I don't think it is properly accessing the current
>> >Request object. When I try the code block below, it gives #Error.
>> >
>> >Function GetServerName() As String
>> > Return
>> System.Web.HttpContext.Current.Request.ServerVariable("server_name")
>> >End Function
>> >
>> >And then in the report, say =Code.GetServerName()
>> >
>> >Please let me know if you have luck with this, or can give more
>> suggestions.
>> > Thanks!
>> >
>> >"daniel_xi" wrote:
>> >
>> >> Hi David,
>> >>
>> >> In the Report properties window, under the Reference tab, you
should
>> add
>> >> a reference to the System.Web namespace, the HttpRequest class is
>> located in
>> >> there, and you should be able to call it in a function (declared in
the
>> Code
>> >> tab).
>> >>
>> >> I hope this helps,
>> >>
>> >> Daniel.
>> >>
>> >> "David" wrote:
>> >>
>> >> > How can a report access the Request.ServerVariables collection?
What
>> we are
>> >> > trying to do is customize a piece of the report (through an if
>> statement)
>> >> > depending on one of the values in the ServerVariables collection,
and
>> if we
>> >> > create a custom assembly, it doesn't have access to the Request
object.
>> >
>>
>