有没有办法将不同的ajax请求发送到同一个ASPX页面?我尝试过使用多个Context.Request.Form,但似乎无法正常工作。
$.ajax({
type: "POST",
url: "/submit.aspx",
data: "request="
});
$.ajax({
type: "POST",
url: "/submit.aspx",
data: "request2="
});
submit.aspx页面:
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim email_Request As New Thread(
Sub()
Dim Request As String = Context.Request.Form("request")
' email code here
End Sub
)
email_Request.Start()
Dim email_Request2 As New Thread(
Sub()
Dim Request2 As String = Context.Request.Form("request2")
' email code here
End Sub
)
email_Request2.Start()
End Sub
答案 0 :(得分:0)
在你的情况下你不需要线程,IIS负责这一点。根据查询字符串执行不同的操作。
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim Request As String = Context.Request.Form("request")
Dim Request2 As String = Context.Request.Form("request2")
If Not String.IsNullOrEmpty(Request) Then
' ...
Else If Not String.IsNullOrEmpty(Request2) Then
' ...
End If
End Sub