asp classic - How to escape double quotes if the variable is coming from database? -


i know double quotes can escaped this:

string test = "he said me, ""hello world"". how you?"  

or by:

string test = "he said me, \"hello world\" . how you?" 

but don't want change value in database, want value database , put url. example :

 href="http://www.abcd.com/movie/<%= mtitle%>/" 

if string contains double quote breaks url.

in case you're not "escaping" quotes, you're url-encoding them. problem isn't string itself. problem many "special characters" have other meanings in context of url, or in way confuse parsing of url, , need encoded.

(in case, it's not url itself, html attribute being confused quotes.)

something this:

<a href="http://www.abcd.com/movie/<%= server.urlencode(mtitle) %>"> 

so instead of output:

<a href="http://www.abcd.com/movie/a"quoted"string"> 

you'd this:

<a href="http://www.abcd.com/movie/a%22quoted%22string"> 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -