views:

112

answers:

2

Hello guys,

I need from a c# code to make a redirect and pass data to it.

Can sy point me the right direction? how to write binary data on an httpcontext, redirect it to http://myserver/hello.aspx and take back this binary on the page load of http://myserver/hello.aspx

thx in advance

A: 

If it is not a big amount of data (there are limits on the length of the url) you could serialize your data and pass it as a querystring parameter. You redirect to http://myserver/hello.aspx?param1=0102030405060708090A0B0C on the page load, you read the querystring and deserialize it.

Not sure but I think to remember the default max for the querystring is 2048 bytes, so anything close to 1K of binary data would be your maximun if you serialize to hex string. You could try base64 but you would need to sanitize it as it would include non valid caracters (like /,and ? and =).

jvanderh
I knew about this solution but in the past I made it in the way that I was writing in the outputstream and then reading on the server side from the inputstream but I cannot make this working anymore and I cannot find the code I was using and I might think that I wasn't using a redirect but a webclient
A: 

FYI

I got the solution from another forum

it's not possible doing such thing with a redirect.

the two only ways seems to be :

use querystring as you mentionned use server.redirect and use the "previouspage"

Thx anyway