SSRS: Next and Previous page buttons don't work - sql-server-2008

I have a vs2012 web project using NET 3.5 and the SSRS reportviewer control (v11) running on MSSQL 2008. When the report displays the next page button doesn't work. It appears to respond to the click (ie the button is enabled and the page load event in the code behind is called) but it doesn't display a new page. When I access the report directly thru the SSRS reportserver URL, I get the same page but it works without any problems. Also, when I export the report to a PDF using the built in export option on the same screen, the correct, entire report is there. I believe viewstate is enabled...no mvc. Here is the relevant code:
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerUrl = new Uri(WebConfigurationManager.AppSettings["SSRSUrl"]);
param[0] = new ReportParameter("SubTitle", subTitle);
param[1] = new ReportParameter("Query", query);
param[2] = new ReportParameter("Parameters", reportParameterString);
param[3] = new ReportParameter("Title2", title2);
ReportViewer1.ShowParameterPrompts = false;
if (!IsPostBack) ReportViewer1.ServerReport.SetParameters(param);
ReportViewer1.ServerReport.Refresh();

Related

SSRS report external image source

I am trying to create a solution to show dynamic images in SSRS reports. I have .NET process that generates Base64 strings that after decoding returned to the client. Here is C# code:
byte[] imageBytes = Convert.FromBase64String(image);
MemoryStream exportStream = new MemoryStream(imageBytes, 0, imageBytes.Length);
exportStream.Position = 0;
return Ok(exportStream);
where image is the Base64 string.
It works fine when a client is a Browser. But in the report it shows Red X when I am running it in the report builder. Published report shows nothing at all. Seems like the report doesn't fully understand the return format or something else. Please share any idea.
Thanks
Image properties:

MS Teams - TaskModule close the window

I display a third party web page(client page) in the task module
using Deeplink
https://teams.microsoft.com/l/task/botid?url=https:test.com/test.html&height=450&width=510&title=Custom+Form&completionBotId=botid
new AdaptiveOpenUrlAction() { Title = "Enable MS Team access", Url = new Uri(DeeplinkHelper.DeepLink }
Here the web page is opening in Task module, I need to close this task module by clicking the button available on the web page(URL) and send the result to completionBotId.
Any sample pls that need to implement in client-side code.
There are two steps to make this work:
you need to reference the Teams Javascript SDK in your web page
When your user clicks the button, you would call microsoftTeams.tasks.submitTask in your 'click' event handler. There are a few parameter options for this method, depending on whether you want it to send anything back to your bot. To simply close the window, call microsoftTeams.tasks.submitTask(null);, or if you want to send an object back, call microsoftTeams.tasks.submitTask(whateverObjectYouWantToSendBack);

SSRS -External image not rendering on HTML report

I am working on SSRS Report. I have a report with an external image embedded in it
This renders fine inside the report viewer.
but when I render report in HTML 4.0 format in my application via web url (without using report viewer).The report that comes back from all the data except the image is not in the html
see the image tag looks like the following:-
<img onerror="this.errored=true;" class="r1" src="http://ges-server-pc/ReportServer_SQLEXPRESS?%2FGES-MVC%2FGES_FWCR&rs%3ASessionID=vdpuofii3xtph545xelnym45&rs%3AFormat=HTML4.0&rs%3AImageID=1403af250c474da8a5f851b63a8a377b">
how can I render extrenal image on Report which is in format= HTML 4.0
Can Anybody have solution for the same It will be appreciable
Thanks in advance
Here is one way to ensure that your application can reliably display images dynamic rendered in a report by SSRS.
When you are using the report viewer control, a lot is done behind the scenes to keep an active session and allow access to all artifacts generated by reports requested by the user. When you are using the ReportExecution api directly there are some advanced reporting features that are just not supported. Interactive sorting, sizing, drilldown and this issue just to name a few.
Always ensuring dynamic images from reports are available to your client is pretty easy. I had to cross this hurdle a way back and I'll share the way I solved it.
In a nutshell, you are going to have to intercept the render, iterate the streams, and save each resource to a temp folder and tell ssrs to look for the image in your temp folder that is behind the web app that your end user has authenticated with.
DeviceInfo
The device info structure, mostly overlooked, is going to come in handy. In this structure you will find a StreamRoot property. You can find documents on this. It basically allows you to override the location from which SSRS will stream resources as needed. This is how you tell SSRS to look for your external images in a new location.
For each report rendered I create a temp folder using a guid prior to rendering. Also, prior to rendering you need to set the StreamRoot to this temp folder.
string physicalTempFolder = MakeNewTempFolderInTempOffOfWebRoot();
string virtualTempFolder = Path.Combine(yourWebRoot,"Temp",Path.GetDirectoryName(physicalTempFolder));
Now you have a physical and virtual pointer to your repo where the images will be saved for your report. Now update the StreamRoot in SSRS. This tells SSRS that we want to override the default location for dynamic images and whatnot.
StringBuilder devInfo = new StringBuilder();
if (YourRenderFormat=="HTML")
{
devInfo.Append("<DeviceInfo>");
devInfo.Append("<StreamRoot>" + virtualTempFolder+ "</StreamRoot>");
devInfo.Append("</DeviceInfo>");
}
With the needed device info structure build we can pass it into the render method.
string extension;
string mimeType;
string reportEncoding;
string[] streamIDs = null;
ReportExecution2005.Warning[] warnings = null;
ReportExecution2005.ExecutionHeader execHeader = new ReportExecution2005.ExecutionHeader();
ReportExecution2005.ExecutionInfo rpt = _execService.LoadReport(YourReportPath, null);
if(YourParamas!=null)
_execService.SetExecutionParameters(YourParams, "en-us");
_execService.ExecutionHeaderValue = execHeader;
_execService.ExecutionHeaderValue.ExecutionID = rpt.ExecutionID;
result = _execService.Render(format, devInfo.ToString(), out extension, out mimeType, out reportEncoding, out warnings, out streamIDs);
The render method returns the streamIDs out parameter and it is key here. Next after we call render, simply iterate all the streams that are images and call ssrs's RenderStream() method to get the images and save to your physical temp folder.
if (YourRenderFormat=="HTML"))
{
string imageEncoding = "";
// For each image stream returned by the call to render,
// render the stream and save it to the application root
string FilePath = physicalTempFolder;
byte[] image;
// For each image stream returned by the call to render,
// render the stream and save it to the application root
foreach (string streamID in streamIDs)
{
image = _execService.RenderStream("HTML4.0", streamID, null, out imageEncoding, out mimeType);
//All files are unique
File.WriteAllBytes(Path.Combine(physicalTempFolder,streamID),image);
}
}
return result;

display reporting services report into asp.net web form

Hello everyone here you see my report in when i run it into my web service URL
but when i run it in an asp.net web form, it display like the second one why please
Here is a sample of my code:
MyReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
MyReportViewer.ServerReport.ReportServerUrl = New Uri("jean-daniel/ReportServer_SQLEXPRESSADDD") ' Report Server URL
MyReportViewer.ServerReport.ReportPath = "/Report Project2/Auction" ' Report Name
MyReportViewer.ShowParameterPrompts = True MyReportViewer.ShowPrintButton = True
MyReportViewer.ShowToolBar = False MyReportViewer.ServerReport.Refresh()
The charts are images and set to store one per session in cache. So if user a and user b access the same chart then it will come back as chart a. - a caching issue. I found a workaround noted below:
Workaround

Execution 'iwy2vpzo52pmp555ftfn4455' cannot be found (rsExecutionNotFound)

Some users get the following error when running reports.
• Execution 'iwy2vpzo52pmp555ftfn4455' cannot be found (rsExecutionNotFound)
They run fine in the morning.
Any suggestions?
Thank you
I can help.
The problem is that the ReportViewer control uses Session to store the currently executing report. Once you navigate away from the reports, the item still remains and eventually loses its "execution context", which is the way Report Server caches reports.
Therefore, before browsing a report, you should attempt to clear out the Session of these reports, so that there are NO cached reports in the Session, and the ReportViewer control can work properly.
You will also find that sometimes when accessing Session.Keys.Count, this error can occur, as again, the execution context has failed.
Make sure you do this on the page showing the report!!
The 2 options are:
if (!IsPostBack)
{
HttpContext.Current.Session.Clear();
ReportViewer1.ServerReport.ReportServerUrl = new Uri(ReportServerUrl, System.UriKind.Absolute);
ReportViewer1.ServerReport.ReportPath = ReportPath;
System.Collections.Generic.List<ReportParameter> parameters = new System.Collections.Generic.List<ReportParameter>();
....
ReportViewer1.ServerReport.SetParameters(parameters);
ReportViewer1.ServerReport.Refresh();
}
Or
for (int i = 0; i < HttpContext.Current.Session.Keys.Count; )
{
if (HttpContext.Current.Session[i].ToString() == "Microsoft.Reporting.WebForms.ReportHierarchy")
HttpContext.Current.Session.RemoveAt(i);
else
i++;
}
I am using SSRS 2017 and was running into this issue when trying to load a report into my MVC project using URL Access. The issue for me had to do with session.
To check this for yourself, you can try deleting the RSExecutionSession cookie and reload your report. Unfortunately, this is only a temporarily fix.
If this does work, try adding rs:ClearSession=true to your query string.
You can read about this setting here.
Look for a trailing space on the report path. This was the cause for me.
On the web.config's impersonation, use identity
impersonate="true"
userName="xxxxx"
password="xxxxx"
instead of : !--<identity impersonate="true"
Hope it helps
If you're running SQL Server Express edition, the SQL Server Agent isn't running to clean up your old SSRS sessions. You'll need to run a job on SSRS DB to clean up the old sessions.
My report took 10 seconds to run and 2 seconds to export - so it wasn't to do with the session expiry length.
I'd get the error when exporting a report to excel into my app an hour after I exported the report.
This error was causing my application to display a run time error.
I added this to the Global.asax class to resolve the error. Tried Server.Clear but got nothing. Session.Clear got rid of the error completely.
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
If ex.InnerException IsNot Nothing Then
If ex.InnerException.ToString.Contains("The report execution") AndAlso
ex.InnerException.ToString.Contains("rsExecutionNotFound") Then
Session.Clear()
Return
End If
End If
End Sub
While it may not be 100% applicable to the question above, I haven't been able to find any other resolution.