【发布时间】:2011-01-14 16:33:01
【问题描述】:
我有一个 aspx 页面,我想将值发布到新页面,然后重定向到该新页面。我没有收到任何错误,并且发生了重定向,但 AllKeys 集合始终为空。
这是我的代码示例:
Try
With strPost
.Append("User=" & strUserName)
.Append("&Session=" + strValue)
End With
Dim objRequest As Net.HttpWebRequest = _
Net.WebRequest.Create("http://localhost:57918/testproject/test.aspx")
With objRequest
.Method = "POST"
.ContentType = "application/x-www-form-urlencoded"
.ContentLength = strPost.ToString().Length
End With
Dim objStream As IO.StreamWriter = _
New IO.StreamWriter(objRequest.GetRequestStream())
objStream.Write(strPost.ToString)
objStream.Close()
Catch ex As Exception
Debug.Print(ex.Message)
Exit Sub
End Try
Response.Redirect("http://localhost:57918/testproject/test.aspx")
我看过一些类似这个问题的文章,但都没有帮助。我做错了什么?
【问题讨论】:
标签: asp.net post httpwebrequest