We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Imports System.IO Imports System.Net Partial Class response Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim strDataToPost As String Dim myWebRequest As WebRequest Dim myRequestStream As Stream Dim myStreamWriter As StreamWriter Dim myWebResponse As WebResponse Dim myResponseStream As Stream Dim myStreamReader As StreamReader ' Create a new WebRequest which targets that page with which we want to interact. myWebRequest = WebRequest.Create("response.aspx") ' Set the method to "POST" and the content type so the server knows to expect form data in the body of the request. With myWebRequest .Method = "POST" .ContentType = "application/x-www-form-urlencoded" End With myResponseStream = myWebResponse.GetResponseStream() myStreamReader = New StreamReader(myResponseStream) Dim FILENAME As String = Server.MapPath("TextFile.txt") File.Delete(FILENAME) Dim objStreamWriter As StreamWriter objStreamWriter = File.AppendText(FILENAME) objStreamWriter.WriteLine(myStreamReader.ReadToEnd()) objStreamWriter.Close() myStreamReader.Close() myResponseStream.Close() ' Close the WebResponse myWebResponse.Close() End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.