cdemott33
asked on
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!
Is there a better more secure way of doing this? Any suggestions would be appriciated. Thanks!
look at : https://www.experts-exchange.com/questions/23097518/Alternative-to-querystring.html
Well, you could use a session...but I would continue using the querystring.
It would let your users bookmark a link directly to a category...like:
http://www.mysite.com/prod ucts.aspx? cat=furnit ure
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...
It would let your users bookmark a link directly to a category...like:
http://www.mysite.com/prod
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
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.
Regards
Bedanand
http://www.dot4pro.com
Regards
Bedanand
http://www.dot4pro.com
ASKER
I guess my main concern is that the querystring value, such as...
products.aspx?category=fur ntiure
...is 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?
products.aspx?category=fur
...is 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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for all your help!