How to send a big amount of data from an aspx page to another

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

Hi,
I have webpage (sql.aspx) in asp.net with a big textbox. In this
box, I generate SQL queries. Some of the queries can takes more than
2000 characters lenght. I want to send the content of the textbox (the
query) in another webpage(result.aspx) textbox. I just don't know how.
Can I use postmethod send ? can I use a public textbox object ? and
how ?

thank you,
Simon
 
You could use something like the following to Post that data to your
receiver page and then use the posted data 'Request.form.tosting()' to
process it from the receiver page. Something like the following (not tested)
Carefull for screen wrapping.

<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>

<html>
<script language="vb" runat="server">

Sub button_click(sender as object, e as EventArgs)

Dim mgWebRequest As HttpWebRequest
Dim stringPost, stringResult As String
Dim mgStreamWriter As StreamWriter
Dim mgWebResponse As HttpWebResponse
Dim mgStreamReader As StreamReader

mgWebRequest
=CType(WebRequest.Create("http://your.website.com/yourreceive.aspx"),HttpWeb
Request)

mgWebRequest.Method = "POST"
stringPost = senddata.text
mgWebRequest.ContentLength = stringPost.length 'length
mgWebRequest.ContentType = "application/x-www-form-urlencoded"
mgStreamWriter = Nothing
mgStreamWriter = New StreamWriter(mgWebRequest.GetRequestStream())
mgStreamWriter.Write(stringPost)
mgStreamWriter.Close()
mgWebResponse = CType(mgWebRequest.GetResponse(),HttpWebResponse)
mgStreamReader = New StreamReader(mgWebResponse.GetResponseStream())
stringResult = mgStreamReader.ReadToEnd()
response.write(stringResult)
mgStreamReader.Close()
end sub
</script>
<body>
<form runat=server>
<asp:textbox id=senddata text="text that your want to send" width=500
textmode=multiline rows=26 wrap=true runat=server/>
<asp:button id=send text=send onclick=button_click runat=server/>
</form>
</body>
</html>
 
Back
Top