Passing XML as parameter to Web page

G

Guest

I must be missing something, because this should be easy to do.

After the user has selected several options on a page, I do a database query
which returns a few records that I want to pass to another page via XML. How
do I do this?

I typically Response.Redirect around my app, including various parameters.
Do I just include the XML as a parameter as in:
Response.Redirect("page.aspx?" & ds.WriteXML)

That just doesn't seem right.

If you would be so kind as to include both what the sending and receiving
should be doing in any example it would be greatly appreciated!
 
M

MWells

So you have a page, "Page1" which captures some criteria, and then performs
a database query, and passes those results to "Page2" for display.

If it's a particularly small amount of XML, I suppose you could use the
query string, though you want to encode your querystring;

Response.Redirect("page.aspx?" & Server.UrlEncode (ds.WriteXML))

But that seems like a particularly risky way to use a querystring.

It makes more sense to me collect your criteria in Page1, then pass the
actual query parameters to Page2, and have Page2 do the query itself. In
most cases the query params will take much less space to transmit than the
query results. Also it makes Page2 more generally usable [barring special
security concerns].

Another option is to do the query, cache either the query or the result in
the database, and then pass the queryID to Page2. That's a useful approach
for very large complex queries, especially if you want to keep a history of
queries a user has run. I use that for real-estate sites, where the user
can have hundreds of criteria, and the broker needs to know what the
customer is searching for.

/// M
 
G

Guest

Can you use “Session� You can store XML as DOM object or string in Session,
and pass Session state to next page, or next of next page. Session is a
popular way to carry data to next page in ASP.NET.

Shaw


MWells said:
So you have a page, "Page1" which captures some criteria, and then performs
a database query, and passes those results to "Page2" for display.

If it's a particularly small amount of XML, I suppose you could use the
query string, though you want to encode your querystring;

Response.Redirect("page.aspx?" & Server.UrlEncode (ds.WriteXML))

But that seems like a particularly risky way to use a querystring.

It makes more sense to me collect your criteria in Page1, then pass the
actual query parameters to Page2, and have Page2 do the query itself. In
most cases the query params will take much less space to transmit than the
query results. Also it makes Page2 more generally usable [barring special
security concerns].

Another option is to do the query, cache either the query or the result in
the database, and then pass the queryID to Page2. That's a useful approach
for very large complex queries, especially if you want to keep a history of
queries a user has run. I use that for real-estate sites, where the user
can have hundreds of criteria, and the broker needs to know what the
customer is searching for.

/// M


Steven J. Reed said:
I must be missing something, because this should be easy to do.

After the user has selected several options on a page, I do a database query
which returns a few records that I want to pass to another page via XML. How
do I do this?

I typically Response.Redirect around my app, including various parameters.
Do I just include the XML as a parameter as in:
Response.Redirect("page.aspx?" & ds.WriteXML)

That just doesn't seem right.

If you would be so kind as to include both what the sending and receiving
should be doing in any example it would be greatly appreciated!
 
G

Guest

Thank you both for your responses. I guess you confirmed my suspicions: you
can't pass a stream as the parameter. I will have to pass the text.

I didn't say it in my original post, but there are a couple of reasons I
can't just do the query in Page2. 1) The database query must be kept
independent from the processing due to manipulation of the data and the fact
the data may be coming from multiple sources. 2) Page2 may be on a
different server. 3) Page2 is actually a few different pages, so the desire
is that the query done in Page1 passes common data to subsequent pages.

....Steve

Shaw said:
Can you use “Session� You can store XML as DOM object or string in Session,
and pass Session state to next page, or next of next page. Session is a
popular way to carry data to next page in ASP.NET.

Shaw


MWells said:
So you have a page, "Page1" which captures some criteria, and then performs
a database query, and passes those results to "Page2" for display.

If it's a particularly small amount of XML, I suppose you could use the
query string, though you want to encode your querystring;

Response.Redirect("page.aspx?" & Server.UrlEncode (ds.WriteXML))

But that seems like a particularly risky way to use a querystring.

It makes more sense to me collect your criteria in Page1, then pass the
actual query parameters to Page2, and have Page2 do the query itself. In
most cases the query params will take much less space to transmit than the
query results. Also it makes Page2 more generally usable [barring special
security concerns].

Another option is to do the query, cache either the query or the result in
the database, and then pass the queryID to Page2. That's a useful approach
for very large complex queries, especially if you want to keep a history of
queries a user has run. I use that for real-estate sites, where the user
can have hundreds of criteria, and the broker needs to know what the
customer is searching for.

/// M


Steven J. Reed said:
I must be missing something, because this should be easy to do.

After the user has selected several options on a page, I do a database query
which returns a few records that I want to pass to another page via XML. How
do I do this?

I typically Response.Redirect around my app, including various parameters.
Do I just include the XML as a parameter as in:
Response.Redirect("page.aspx?" & ds.WriteXML)

That just doesn't seem right.

If you would be so kind as to include both what the sending and receiving
should be doing in any example it would be greatly appreciated!
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top