1.aspx在后台把数据传递至2.aspx时是否会触发2.aspx的Page_Load事件?我该如何验证1.aspx传递的数据已经被2.aspx接收到了呢?1.aspx
-------------
Function PostData(ByVal url As String, ByVal Data As String) As Boolean
Dim encoding As Encoding = Text.Encoding.GetEncoding("GB2312")
Dim buff As Byte() = encoding.GetBytes(Data)
Dim myRequest As HttpWebRequest = WebRequest.Create(url)
myRequest.Method = "POST"
myRequest.ContentType = "application/x-www-form-urlencoded"
myRequest.ContentLength = buff.Length
Dim newStream As Stream = myRequest.GetRequestStream
newStream.Write(buff, 0, buff.Length)
newStream.Close()
End Function2.aspx
-------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
LogError("ssss") 'LogError是一个写文本的函数,我直接加载2.aspx是可以执行该函数的。
End Sub
-------------
Function PostData(ByVal url As String, ByVal Data As String) As Boolean
Dim encoding As Encoding = Text.Encoding.GetEncoding("GB2312")
Dim buff As Byte() = encoding.GetBytes(Data)
Dim myRequest As HttpWebRequest = WebRequest.Create(url)
myRequest.Method = "POST"
myRequest.ContentType = "application/x-www-form-urlencoded"
myRequest.ContentLength = buff.Length
Dim newStream As Stream = myRequest.GetRequestStream
newStream.Write(buff, 0, buff.Length)
newStream.Close()
End Function2.aspx
-------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
LogError("ssss") 'LogError是一个写文本的函数,我直接加载2.aspx是可以执行该函数的。
End Sub
Function PostData(ByVal url As String, ByVal Data As String) As Boolean
Dim encoding As Encoding = Text.Encoding.GetEncoding("GB2312")
Dim buff As Byte() = encoding.GetBytes(Data)
Dim myRequest As HttpWebRequest = WebRequest.Create(url)
myRequest.Method = "POST"
myRequest.ContentType = "application/x-www-form-urlencoded"
myRequest.ContentLength = buff.Length
Dim newStream As Stream = myRequest.GetRequestStream
newStream.Write(buff, 0, buff.Length)
newStream.Close()
End Function