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

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
 
A

alien2_51

If the page has same session scope(in the same virtual directory) use
session...
 
V

vMike

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top