使用asp.net核心mvc,我在操作中设置了如下Cookie:
Option Explicit
Public Sub Login()
Dim ie As New InternetExplorer 'InternetExplorerMedium
Const MAX_WAIT_SEC As Long = 5
Dim t As Date, ele As Object
With ie
.Visible = True
.navigate "https://portal.expeditors.com/expo/login"
While .Busy Or .readyState < 4: DoEvents: Wend
With .document
Do
DoEvents
On Error Resume Next
Set ele = .getElementById("j_username")
On Error GoTo 0
If Timer - t > MAX_WAIT_SEC Then Exit Do
Loop While ele Is Nothing
If ele Is Nothing Then Exit Sub
With ele
.Focus
.Value = "bob"
End With
With .getElementById("j_password")
.Focus
.Value = "penny"
End With
.getElementById("signInBtn").Click
End With
While .Busy Or .readyState < 4: DoEvents: Wend
Stop '<== Delete me later
.Quit
End With
End Sub
在另一个站点上使用ajax调用此操作,例如:anothersite.com 因此anothersite.com使用ajax调用mysite.com,响应头为:
def floodfill(x, y, oldColor, newColor):
# assume surface is a 2D image and surface[x][y] is the color at x, y.
theStack = [ (x, y) ]
while (len(theStack) > 0):
x, y = theStack.pop()
if (x == 224):
continue
if (x == -1):
continue
if (y == -1):
continue
if (y == 224):
continue
if edges[x][y] != oldColor:
continue
edges[x][y] = newColor
theStack.append( (x + 1, y) ) # right
theStack.append( (x - 1, y) ) # left
theStack.append( (x, y + 1) ) # down
theStack.append( (x, y - 1) ) # up
但是问题是cookie不会保存在浏览器中以用于后续请求,并且同一站点在chrome浏览器的应用程序标签上显示Lax。
知道为什么会这样吗?