diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index e00e24ed8..7ffb360e7 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5136,55 +5136,43 @@ Public Class ClsPaginas 'limpio ReportViwer Dim sw As New System.Diagnostics.Stopwatch() sw.Start() - 'Dim Bytes As Byte() = Nothing - 'Try - ' Dim fllreport As New ADSReportLib.FullTrustReportviewer() - ' fllreport.Initialize("DisplayName", RutaReporte, Parametros, New List(Of String()), True) - ' For Each RDS As ReportDataSource In DataSource - ' fllreport.AddDataSources(RDS) - ' Next - ' Dim Warnings As Warning() = Nothing - ' Dim StreamIds As String() = Nothing - ' Dim MimeType As String = Nothing - ' Dim Encoding As String = Nothing - ' Dim Extension As String = Nothing - ' Bytes = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) - ' fllreport = Nothing - 'Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException - ' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") - ' 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 - ' 'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") - 'Catch ex As Exception - ' GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") - ''HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 - ''GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") - 'End Try - - If IsNothing(MR) Then MR = New ReportViewer - Dim Bytes As Byte() = Nothing + + + Dim setup As AppDomainSetup = New AppDomainSetup + With setup + .ApplicationBase = Environment.CurrentDirectory + .LoaderOptimization = LoaderOptimization.MultiDomainHost + End With + setup.SetCompatibilitySwitches({"NetFx40_LegacySecurityPolicy"}) + Dim _casPolicyEnabledDomain As AppDomain = AppDomain.CreateDomain("Full Trust", Nothing, setup) + Try + 'Dim rvNextgenReport2 As WebReportviewer.FullTrustReportviewer = CType(_casPolicyEnabledDomain.CreateInstanceFromAndUnwrap(GetType(WebReportviewer.FullTrustReportviewer).Assembly.CodeBase, GetType(WebReportviewer.FullTrustReportviewer).FullName), WebReportviewer.FullTrustReportviewer) + 'rvNextgenReport2.Initialize(DisplayName, ReportPath, Visible, reportParam, reportRenderFormat, DeviceInfo, repMainContent, repSubContent) + 'For Each _ReportDataSource As ReportDataSource In DataSources + ' rvNextgenReport2.AddDataSources(_ReportDataSource.Name, CType(_ReportDataSource.Value, DataTable)) + 'Next + + 'Return rvNextgenReport2.Render(reportRenderFormat, DeviceInfo) + Dim fllreport As ADSReportLib.FullTrustReportviewer = CType(_casPolicyEnabledDomain.CreateInstanceFromAndUnwrap(GetType(ADSReportLib.FullTrustReportviewer).Assembly.CodeBase, GetType(ADSReportLib.FullTrustReportviewer).FullName), ADSReportLib.FullTrustReportviewer) + Dim bdir As String = AppDomain.CurrentDomain.BaseDirectory + RutaReporte.Replace("/", "\") + If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then + RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) + End If + fllreport.Initialize("DisplayName", RutaReporte, Parametros.AsEnumerable(), New List(Of String()), True) For Each RDS As ReportDataSource In DataSource - MR.LocalReport.DataSources.Add(RDS) + fllreport.AddDataSources(RDS.Name, DirectCast(RDS.Value, DataTable)) Next - 'Dim permissions As New Security.PermissionSet(Security.Permissions.PermissionState.None) - 'permissions.AddPermission(New Security.Permissions.FileIOPermission(Security.Permissions.PermissionState.Unrestricted)) - 'permissions.AddPermission(New Security.Permissions.SecurityPermission(Security.Permissions.SecurityPermissionFlag.Execution)) - 'MR.LocalReport.SetBasePermissionsForSandboxAppDomain(permissions) - - MR.LocalReport.ReportPath = RutaReporte - MR.ProcessingMode = ProcessingMode.Local - MR.LocalReport.EnableExternalImages = True - MR.LocalReport.SetParameters(Parametros) - MR.LocalReport.Refresh() Dim Warnings As Warning() = Nothing Dim StreamIds As String() = Nothing Dim MimeType As String = Nothing Dim Encoding As String = Nothing Dim Extension As String = Nothing - Bytes = MR.LocalReport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) - + Bytes = fllreport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds) + fllreport = Nothing Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 @@ -5193,9 +5181,9 @@ Public Class ClsPaginas GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") + Finally + AppDomain.Unload(_casPolicyEnabledDomain) End Try - MR.LocalReport.ReleaseSandboxAppDomain() - MR.Dispose() sw.Stop() If sw.Elapsed.TotalSeconds > 10 Then diff --git a/Bin/ADSReportLib.dll b/Bin/ADSReportLib.dll index d1edd2a16..7a6f699af 100644 Binary files a/Bin/ADSReportLib.dll and b/Bin/ADSReportLib.dll differ diff --git a/Bin/ADSReportLib.pdb b/Bin/ADSReportLib.pdb index 9b46fdb6d..3dee6c009 100644 Binary files a/Bin/ADSReportLib.pdb and b/Bin/ADSReportLib.pdb differ diff --git a/vwd.webinfo b/vwd.webinfo index 9a68975f3..6f1eb2f43 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -36,6 +36,10 @@ + + + +