Alternative to QueryString

I'm building a web store.  When a visitor clicks on a product category link, such as "Furniture" or "Clothing", I would pass the a variable that represented their selection via a querystring.  This variable would be used in my SQL code to retrive the products from my database and load them onto the page.

Is there a better more secure way of doing this?  Any suggestions would be appriciated.  Thanks!
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

samtran0331Connect With a Mentor Commented:
>>I've been told to use sql parameters to help with sql injection attackes but do you all believe that secure enough?

Sql injections works by trying to concatentate additional sql statements into yours...if you use parameters, the concatenation fails because it is a parameter to your can't be bypassed by the injection.
Sreedhar VengalaSr. Consultant - Business IntelligenceCommented:
Well, you could use a session...but I would continue using the querystring.
It would let your users bookmark a link directly to a
I've got tons of links to different ebay, amazon, and carmax searches and products that wouldn't work if they didn't use querystrings!

If your concern is security...just make sure you pass the querystring to your SQL with a parameter and/or to a stored procedure and I don't think you need to be overly concerned about security...
Alternately, you could implement some basic encryption on your querystring variables if you're really concerned...but..again...I don't think you need to be...
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Sreedhar VengalaSr. Consultant - Business IntelligenceCommented:
The most important thing here is why do u want to secure the querystring. If you dont want you users to able to see categoryid actually used, you can use some function on your app to encrypt and decrypt the category id so that the acutall id will be hidden from the users point of view.


cdemott33Author Commented:
I guess my main concern is that the querystring value, such as...

products.aspx?category=furntiure used in my sql statement.  So on button click I assign the value of the querystring to a string variable that's pumped into my SELECT statement.  (ie SELECT * FROM catalog WHERE productTpye = ** my request.querystring value** )

I've been told to use sql parameters to help with sql injection attackes but do you all believe that secure enough?

cdemott33Author Commented:
Thanks for all your help!
All Courses

From novice to tech pro — start learning today.