|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
General - Question - Properly encoded quoted strings
I don't exactly know how to even phrase my question with the correct wording. I don't use ASP too often, and I'm looking to save information to a <input type="hidden" /> field, but it gets all screwed up because the information I'm saving in the field has characters that are ungood. as an example if I try and save certain data in the hidden field with:
Code:
<input id="fldData"
name="fldData"
type="hidden"
value="<%= strData %>" />
I can get garbage like: Code:
<input id="fldData"
name="fldData"
type="hidden"
value=" Hello with line feeds
< and angle brackets >
" and even ' quotes "
This is no good!!" />
Is there someway to encode this stuff with a asp/vbscript command? and if so, do i need to decode it when I get it using: Code:
Dim strData
strData = Request.QueryString("fldData")
|
|
#2
|
|||
|
|||
|
I think I figured it out myself. I hope it will work, it seems to:
Code:
value="<% Server.HTMLEncode(strData) %>" |
|
#3
|
||||
|
||||
|
you can also use Session variables, this way in case you have sensitive information
it won't be visible at all in the HTML source, right now the user can right click and choose View Soruce, and all the "hidden" values are visible there. |
|
#4
|
||||
|
||||
|
Shad is right. You should use session variables for sending form data between pages.
Hidden form fields are for storing/sending dynamically populated fields that do not require user input.
__________________
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > General - Question - Properly encoded quoted strings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|