diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 3c0189d72..0bd572211 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -10,18 +10,25 @@ Imports System.IO Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest - If context.Request("metodo").ToString() = "GetTokenAngular" Then + If context.Request("metodo") IsNot Nothing AndAlso context.Request("metodo").ToString() = "GetTokenAngular" Then 'context.Response.ContentType = "application/json; charset=utf-8" context.Response.ContentType = "text/json" - Dim origin As String = context.Request.UrlReferrer.ToString() - context.Response.AddHeader("Access-Control-Allow-Origin", origin.Substring(0, origin.Length - 1)) + If context.Request IsNot Nothing AndAlso context.Request.UrlReferrer IsNot Nothing Then + Dim origin As String = context.Request.UrlReferrer.ToString() + context.Response.AddHeader("Access-Control-Allow-Origin", origin.Substring(0, origin.Length - 1)) + End If 'context.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:4200") 'context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST") context.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept") context.Response.AddHeader("Access-Control-Allow-Credentials", "true") context.Response.StatusCode = 200 - Dim key As String = GetTokenAngular(context) + Dim key As String = "" + Try + key = GetTokenAngular(context) + Catch ex As Exception + GuardaLog(ex.ToString()) + End Try Dim json As String = JsonConvert.SerializeObject(key) context.Response.Write(json) context.Response.Flush() diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 6644f7db1..9b8a0ed78 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -658,7 +658,7 @@