URLEncode

D

djc

1) I just recently used my own function which simply replaces cariage return
/ line feed characters with <br> tags for a large detail field before
showing it via an asp.net page to preserve line breaks for web display.

I have since come accross this URLEncode method. Is this something that I
should have used for this instead?

2) currently if you were to enter html tags into an input field on my
asp.net web page the app will crash... I know this is by design for security
reasons and if I don't require html tags being input I should just trap this
error and handle it.

What if I wanted to allow the html tags to be input? (URLEncode?).

any info would be appreciated. Thanks.
 
K

Kevin Spencer

I have since come accross this URLEncode method. Is this something that I
should have used for this instead?

No. URLEncode is for URLs. HtmlEncode encodes strings to HTML-Friendly
format.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
D

djc

thanks for the reply Spencer...
1) My data is stored in 'normal' text in the database. So I can run this
text through HtmlEncode before displaying it on the web page and the line
breaks and spacing would be preserved (in html format)?

2) If I wanted to allow a user, on the data input side of things, to be able
to use html tags would HtmlEncode be used for that also? would the data then
be stored in the database encoded rather than 'normal' text? (bad if a
different non-browser front end were to need to display the data)
Scenario 1: what if I need the data to be stored in the database in
'normal' text but displayed literally when output to screen via browser
(meaning show the html tags... like for showing code examples)?
Scenario 2: what if I need the data to be stored in the database in
'normal' text but when output to the browser have the browser actually
interpret the html tags?

any more info is greatly appreciated. Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top