This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-11-09 09:50:39 -07:00
parent 5c68141877
commit 44c5f1df9a
4 changed files with 14 additions and 37 deletions

View File

@@ -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()