473,796 Members | 2,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URLEncode

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
4 2595
> 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******** ******@tk2msftn gp13.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
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***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OQ******** ******@TK2MSFTN GP10.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******** ******@tk2msftn gp13.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
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******** ******@tk2msftn gp13.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***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OQ******** ******@TK2MSFTN GP10.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******** ******@tk2msftn gp13.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
djc
thanks, will do.

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:up******** ******@TK2MSFTN GP15.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******** ******@tk2msftn gp13.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***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OQ******** ******@TK2MSFTN GP10.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******** ******@tk2msftn gp13.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
28426
by: Joshua Beall | last post by:
Hi All, I can see from the manual that the difference between urlencode and rawurlencode is that urlencode translates spaces to '+' characters, whereas rawurlencode translates it into it's hex code. My question is, is there any real world difference between these two functions? Or perhaps another way of asking the question: *why* are there two different functions? In what situation would you need one, and not be able to use the...
3
7657
by: JP SIngh | last post by:
Hi All I have users who upload files using my application using ASPUPLOAD component. My code uploads the file to a network location and once the upload is finish I display the hyperlink using the following code <a href=\myserver\attachments\<%=server.urlencode(rs("FileName"))%> target="_blank" ><%=rs("Filename")%>
1
3779
by: yawnmoth | last post by:
Any ideas as to why urlencode(addslashes(chr(0))) returns '%5C0'? It seems like it should return '%00' since that's what urlencode(chr(0)) returns. If not that, I could also see it returning '%5C%00' since that's what urlencode('\\').urlencode(chr(0)) and urlencode('\\'.chr(0)) return. '%5C0', however, confuses me. Even urlencode(chr(0x5C0)) doesn't return '%5C0' - it returns '%C0'.
1
5015
by: Jim | last post by:
Hello, I'm trying to do urllib.urlencode() with unicode correctly, and I wonder if some kind person could set me straight? My understanding is that I am supposed to be able to urlencode anything up to the top half of latin-1 -- decimal 128-255. I can't just send urlencode a unicode character:
4
6746
by: Andreas Klemt | last post by:
Hello, is there a difference between System.Web.HttpUtility.UrlEncode and Server.UrlEncode ?
1
5384
by: Dario Sala | last post by:
Hi, what's the difference about Asp Server.UrlEncode and the Asp.Net Server.UrlEncode ? In asp: Server.UrlEncode("*") = %2A In Asp.Net: Server.UrlEncode("*") = *
0
1230
by: Nathan Sokalski | last post by:
I am using Server.UrlEncode to make a piece of data safe to use as a QueryString. The data I am using is as follows: ratedpoem("title") Which returns the following String: "An Expression I Can't Show"
9
4504
by: Mark_Rarefy | last post by:
Trying to urlencode this string: »ÁÏŒŠ˜ªŒ›h^aYh in vb.net (using either HttpUtility.UrlEncode(strEncrypted, encoding.UTF8) orServer.UrlEncode) I get: %c2%90%c2%bb%c3%81%c3%8f%7f%c5%92%c5%a0%cb%9c%c2%aa%c5%92%c2%9d%e2%80%bah%5eaYh in ASP script (using Server.URLEncode) I get: %90%BB%C1%CF%7F%8C%8A%98%AA%8C%9D%9Bh%5EaYh
12
4948
by: sleytr | last post by:
Hi, I'm trying to make a gui for a web service. Site using character in value of some fields. But I can't encode this character properly. >>> data = {'key':''} >>> urllib.urlencode(data) 'key=%C2%B1' but it should be only %B1 not %C2%B1. where is this %C2 coming from?
0
9683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10457
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10231
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9054
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6792
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2927
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.