Need to pass session variables from an asp web page to ssrs report
For our reporting security in SSRS we'll need to pass session variables from an asp web page to ssrs - the emp_id is stored as a session variable in web app, this is one we will use. Im looking for good documentation on how to do this, any suggestions would be appreciated?M Collier
May 21st, 2012 11:07am

Hi There Can you please give some more details how would like to pass the session parameter to SSRS. What version of SSRS you are using (2005/2008)Are you using report viewer control? Or you just calling the report using URL Please let me know then I might be able to help you out Normally when you put default value to a parameter this does not appear specify a Many Thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
Free Windows Admin Tool Kit Click here and download it now
May 21st, 2012 6:15pm

Hi Syed, We are using SSRS 2008 and calling the report using URL. We want to pass the emp_id session variable as a paramater to a sql statement in the report that will check the HR table for security...M Collier
May 22nd, 2012 9:44am

Hi There You just need to put this code in your page load Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ReportNameFullName, ReportName As String Page.Session("EmployeeID") = "C" ReportNameFullName = "matrix.rdl" ReportName = "matrix" HyperLink1.NavigateUrl = String.Format("http://Yourreportserver/ReportServer/Test project/" + ReportNameFullName + "?/Test project/" + ReportName) + "&rs:Command=Render&rs:parameters=false&test=" & Page.Session("EmployeeID") ' End Sub Here Test project is the folder on my report server and your domain is the server name of your report server and test is my parameter name. I am putting screenshot for your help. Many Thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ReportNameFullName, ReportName As String Page.Session("EmployeeID") = "C" ReportNameFullName = "matrix.rdl" ReportName = "matrix" HyperLink1.NavigateUrl = String.Format("http://Yourreportserver/ReportServer/Test project/" + ReportNameFullName + "?/Test project/" + ReportName) + "&rs:Command=Render&rs:parameters=false&test=" & Page.Session("EmployeeID") ' End Sub
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 5:20pm

Hi There You just need to put this code in your page load Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ReportNameFullName, ReportName As String Page.Session("EmployeeID") = "C" ReportNameFullName = "matrix.rdl" ReportName = "matrix" HyperLink1.NavigateUrl = String.Format("http://Yourreportserver/ReportServer/Test project/" + ReportNameFullName + "?/Test project/" + ReportName) + "&rs:Command=Render&rs:parameters=false&test=" & Page.Session("EmployeeID") ' End Sub Here Test project is the folder on my report server and your domain is the server name of your report server and test is my parameter name. I am putting screenshot for your help. Many Thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ReportNameFullName, ReportName As String Page.Session("EmployeeID") = "C" ReportNameFullName = "matrix.rdl" ReportName = "matrix" HyperLink1.NavigateUrl = String.Format("http://Yourreportserver/ReportServer/Test project/" + ReportNameFullName + "?/Test project/" + ReportName) + "&rs:Command=Render&rs:parameters=false&test=" & Page.Session("EmployeeID") ' End Sub
May 27th, 2012 9:15pm

The report page comes up but Im getting error stating that : The 'EmpId' parameter is missing a value Here is my session and hyperlink line : Page.Session( "EmpId") = "110830" HyperLink1.NavigateUrl = String.Format("http://ServerName/Reports/Pages/Report.aspx?ItemPath=%2fNE+IT+Reporting+Applications%2fCETOM%2fReports%2fEmp_Device_Rpt") + "&rs:Command=Render&rs:parameters=false&EmpId=" & Page.Session("EmployeeID") M Collier
Free Windows Admin Tool Kit Click here and download it now
May 30th, 2012 3:43pm

Hi There Please check you script you have defined Page.Session("EmpId") = "110830" and you are passing =" & Page.Session("EmployeeID") I think you need to pass the same session variable which is Page.Session("EmpId") -- Your session variabl is Page.Session("EmpId") = "110830" --and you are passing =" & Page.Session("EmployeeID") --I think you need to pass the same session variable which is Page.Session("EmpId") If you have any questions please do ask. Many Thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful
May 30th, 2012 4:47pm

I changed both names to EmpId...  When I copy the url in the browser with adding "&rs:Command=Render&EmpId=110030" I can get to the page but still the same error - The 'EmpId" parameter is missing a value.. The SSRS side report parameter is call - EmpId I have the parameter set to hidden so it will not show up (tried visible and internal as well), no default values. Im not clear on what the issue is. The parameter Im pulling from the url is assigned to the empid column in my WHERE clause... M Collier
Free Windows Admin Tool Kit Click here and download it now
May 30th, 2012 5:05pm

Hi There There is no problem when you define it as hidden, I have tested it. Please make sure that parameter name is same both in your query as well as inside where you declare Parameter name. Please also make sure about the case sensitivity. It must be exactly same case as you have defined inside the parameter box. It would be good if you please put some screenshot where you define parameter de and also where you are using inside the query. If you have any questions please do ask. Many Thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful
May 30th, 2012 6:28pm

Hi Syed, Thanks this works perfectly. The issue I was having was due the the Report Folder in the link. I changed it to the one specified in the project properties of the report designer project and that resolved it. I appreciate our assistance! MarvinM Collier
Free Windows Admin Tool Kit Click here and download it now
May 31st, 2012 12:06pm

Followup question pertaining to this thread... How can the session variable parameter be passed via the web link in an encryped or hidden manner, to the SSRS report? M Collier
June 7th, 2012 1:41pm

Hi There Thanks for your posting again. As far I know any parameters passed using the GET method (parameters over the URL) will be visible to the user. One option which you might have is encrypting the value before sending it. To encrypt the string, Im afraid you have to create encrypt/decrypt assemblies. Create an encrypt assembly in ASP.net(Web etc) to encrypt the string before you send the value. Add another decrypt assembly in your SSRS report to translate the string to the parameter value. If you have any question please let me know. Many Thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
Free Windows Admin Tool Kit Click here and download it now
June 7th, 2012 4:49pm

From the SSRS documentation it says if you need to pass hidden parameters, the preferred method is URL access through a form POST method (equivalent to a form submission where METHOD='GET') Can you point me to a How Too link for this? M Collier
June 8th, 2012 10:53am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics