Kentico Transformation Access Query String

Carson Wong asked on July 7, 2016 21:41

Hi,

I'm trying to get some parameters from the QueryString in a transformation method using ASCX. With Text/XML, I know you can do {? parameter ?} or {% QueryString.parameter %} but in ASCX, I am not able to do so. What would be the proper way to fetch a parameter from the QueryString?

Correct Answer

Brenden Kehren answered on July 7, 2016 21:47

In an ascx file you can use standard c# code:

<%# Request.QueryString["parameter"] %>
4 votesVote for this answer Unmark Correct answer

Recent Answers


Carson Wong answered on July 7, 2016 21:52

@Brenden, thank you, I did not know about that. It works perfectly now. Thank you very much!

0 votesVote for this answer Mark as a Correct answer

Juraj Komlosi answered on July 8, 2016 14:13

Hi Carson,

Brenden is right. That's the way how to get some parameters from query string. Just be careful and do not forget to sanitize the query string parameter value otherwise you will face the Cross-site scripting vulnerability. You can find more details in article about XSS protection.

Best regards.

2 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.