-- cambios de sesion a cache, en el guardado de viewstate

This commit is contained in:
rrene
2020-06-05 16:37:25 -07:00
parent e95970fc41
commit 537a9e6e98

View File

@@ -5045,8 +5045,8 @@ Public Class ClsPaginas
Protected Overrides Sub SavePageStateToPersistenceMedium(pviewState As Object)
'If Request.Form("__VIEWSTATE_KEY") IsNot Nothing Then Cache.Remove(Request.Form("__VIEWSTATE_KEY")) 'elimino la cachado anteriormente
Dim VSKey As String = String.Format("VIEWSTATE_{0}_{1}_{2}", Session.SessionID, Request.Path, Date.Now.Ticks)
'Cache.Add(VSKey, pviewState, Nothing, Date.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.Default, Nothing) 'Store the ViewState on Cache
Session.Add(VSKey, pviewState) 'Store the ViewState on Cache
Cache.Add(VSKey, pviewState, Nothing, Date.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.Default, Nothing) 'Store the ViewState on Cache
'Session.Add(VSKey, pviewState) 'Store the ViewState on Cache
ClientScript.RegisterHiddenField("__VIEWSTATE_KEY", VSKey)
End Sub
@@ -5056,11 +5056,11 @@ Public Class ClsPaginas
If Not VSKey.StartsWith("VIEWSTATE_") Then 'Request the Key from the page and validade it.
Throw New Exception(String.Format("Invalid VIEWSTATE Key: {0}", VSKey))
End If
If Session(VSKey) Is Nothing Then 'si por algún motivo, el caché expiró, le dice a la página que se recargue y obtenga los datos de nuevo, y así evitar errores al obtener el viewstate vacío
If Cache(VSKey) Is Nothing Then 'si por algún motivo, el caché expiró, le dice a la página que se recargue y obtenga los datos de nuevo, y así evitar errores al obtener el viewstate vacío
Response.Redirect(Request.RawUrl)
Return Nothing
Else
Return Session(VSKey)
Return Cache(VSKey)
End If
End Function
@@ -5268,6 +5268,8 @@ Public Class ClsPaginas
params.Add(param)
Next
Bytes = wsreport.StreamPDFBytes(RutaReporte, ds, params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario)
wsreport = Nothing
params = Nothing
Else
If IsNothing(MR) Then MR = New ReportViewer
Try
@@ -5340,6 +5342,7 @@ Public Class ClsPaginas
End If
sw.Stop()
If sw.Elapsed.TotalSeconds > 5 Then
GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ")
End If
@@ -5592,7 +5595,7 @@ Public Class ClsPaginas
HttpContext.Current.Response.SuppressContent = True
HttpContext.Current.ApplicationInstance.CompleteRequest()
HttpContext.Current.Response.End()
bytes = Nothing
Catch ex As Exception
If UsuarioActual.CveRol = 1 Then