Thursday, March 29, 2012

Pass SQL query to another page safely.

I want to pass an SQL Query from one page to another without the user being able to see it. Can anyone tell me how I can do this?What about putting the query in a session or encrypt it and put it in a hidden text field?
I have done this by treating the SQL (or the parameter parts of it) as a string, writing it to a database, then retrieving it from another page. Its not very elegant I know, but it works just fine if you have a specific unique key to identify your user.

regards

Mike
Two ways I can think of...If you are using response.redirect to move to the next page use session. Otherwise put the query into a page property, server.transfer to the new page, cast the httpcontext as the sending page and access the property. Or try this article on 4guys:

http://aspnet.4guysfromrolla.com/articles/020205-1.aspx
Yeah, I found somthing about the server.urlencode and server.urldecode that the article mentions. I'm not sure whether it will catch everything, but I'll see what happens.

0 comments:

Post a Comment