By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

URLEncode

P: n/a
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.
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
> 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.

"djc" <no***@nowhere.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl... 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.

Nov 19 '05 #2

P: n/a
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.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
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.

"djc" <no***@nowhere.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl...
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.


Nov 19 '05 #3

P: n/a
See:

http://msdn.microsoft.com/library/de...codetopic1.asp

--
HTH,

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

"djc" <no***@nowhere.com> wrote in message
news:e3**************@tk2msftngp13.phx.gbl...
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.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
> 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.

"djc" <no***@nowhere.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl...
> 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.
>
>



Nov 19 '05 #4

P: n/a
djc
thanks, will do.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:up**************@TK2MSFTNGP15.phx.gbl...
See:

http://msdn.microsoft.com/library/de...codetopic1.asp
--
HTH,

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

"djc" <no***@nowhere.com> wrote in message
news:e3**************@tk2msftngp13.phx.gbl...
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.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
> 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.

"djc" <no***@nowhere.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl...
> 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.
>
>



Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.