473,785 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HtmlEncode? Other Alternative?

Hey guys. I'm working a large project that has dozens of forms to collect
user input. A lot of the fields are text and capture long text from the
user. It writes to MS SQL 2000.

I've built a simple "replace" function to replace and encode harmful
characters on the server side such as single quotes, commas and so on.
Problem is that when a user submits a < or a > char, the server barks and
sees it as harmful. For example:

A potentially dangerous Request.Form value was detected from the client
(txtDescription ="My expenses are > my revenues").

It's likely that the user will use these two chars. I thought about looking
into HTMLEncode but this is processed on the server. So how should I handle
this? Should I use HTMLEncode? How do the guru's do it?

Thanks!

(asp.net 2 /vb)



Jun 29 '06 #1
2 1954
Check the following article -

http://www.asp.net/faq/RequestValidation.aspx?tabid=1

Groove wrote:
Hey guys. I'm working a large project that has dozens of forms to collect
user input. A lot of the fields are text and capture long text from the
user. It writes to MS SQL 2000.

I've built a simple "replace" function to replace and encode harmful
characters on the server side such as single quotes, commas and so on.
Problem is that when a user submits a < or a > char, the server barks and
sees it as harmful. For example:

A potentially dangerous Request.Form value was detected from the client
(txtDescription ="My expenses are > my revenues").

It's likely that the user will use these two chars. I thought about looking
into HTMLEncode but this is processed on the server. So how should I handle
this? Should I use HTMLEncode? How do the guru's do it?

Thanks!

(asp.net 2 /vb)


Jun 29 '06 #2
Excellent. Thanks!

--

<bh************ @gmail.com> wrote in message
news:11******** **************@ y41g2000cwy.goo glegroups.com.. .
Check the following article -

http://www.asp.net/faq/RequestValidation.aspx?tabid=1

Groove wrote:
Hey guys. I'm working a large project that has dozens of forms to
collect
user input. A lot of the fields are text and capture long text from the
user. It writes to MS SQL 2000.

I've built a simple "replace" function to replace and encode harmful
characters on the server side such as single quotes, commas and so on.
Problem is that when a user submits a < or a > char, the server barks and
sees it as harmful. For example:

A potentially dangerous Request.Form value was detected from the client
(txtDescription ="My expenses are > my revenues").

It's likely that the user will use these two chars. I thought about
looking
into HTMLEncode but this is processed on the server. So how should I
handle
this? Should I use HTMLEncode? How do the guru's do it?

Thanks!

(asp.net 2 /vb)

Jun 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4088
by: abcd | last post by:
Simple but not working at this moment I have to fill the HTML select control.... my values could be for example "test number 1" sample code, dim x Data = "test number 1"
4
2748
by: Anders Both | last post by:
Hello dotnet.aspnet group - I want to do encode e.g. japanise or arabic text into something like: بةكوردي عةلي Before putting it in my HTML code (aspx page) . But when i try to use System.Web.HttpUtility.HtmlEncode("Some arabic:????????? ???? ????????? ???
3
4110
by: Michael Gaillez | last post by:
Hi, I'm dynamically loading an assembly into an ASP.NET application. In the control that I load from that dynamic assembly I've tried to use Server.HTMLEncode but this results in a serious performance loss. Is there anyone who knows why or is there an alternative for server.htmlencode method? Without the server.htmlencode the thingy works very fine. greetz
4
4683
by: Andy Fish | last post by:
When using databinding, I have gotten into the habit of using single quotes (apostrophe) round attribute values rather than double quotes because this allows visual studio to work when there are quotation marks in the databinding expression. As far as I can tell this seems to be recommended practice. However, I just realised that HtmlEncode doesn't encode apostrophes, so if you do something like this <a href=......
3
2892
by: David Lozzi | last post by:
Howdy, I have my left navigation of Hyperlinks, and part of the link's querystring is the title of the page they are going to. For example, one of the pages is Cars & Trucks. With HtmlEncode, it translates it to Cars%20&%20Trucks. The ampersand is still there. Shouldn't the HtmlEncode translate that? So on the page the title is Cars because its translating the & as a new name/value pair. Any suggestions? Thanks!
0
1505
by: \A_Michigan_User\ | last post by:
I guess I'm not understanding this correctly. I have to set "ValidateRequest=False" for my asp.net 1.1 page that has a TextBox... so that I can avoid an error... if some user enters some html or script coding into it. (Should I HtmlEncode it with Server.htmlEncode or HttpServerUtility.HtmlEncode ???) From what I've read... I guess I'm supposed to do it this way: 1. HtmlEncode the user input that's in the TextBox. 2. Save it to the...
1
14566
by: Marco Miltenburg | last post by:
While working on some multilingual code I found a rather strange thing happening with Server.HTMLEncode. While loading different languages I change the Codepage and Charset in ASP to reflect the language. This all works fine. However when I tried to use Charset UTF-8 with Codepage 65001 everywhere I found that HTMLEncode always translates all UTF-8 characters to &#xxxx. Example:
1
2758
by: Alexander Higgins | last post by:
>>Thanks for the response.... Point Taken but this is not the case. Thus, if a person writes a text file on her or his computer and does not use UNICODE to save it, the current code page is used. If this file is given to someone with some other current codepage, the file is not displayed correctly. Simply converting the file to Unicode will make the data display properly. When performing the encoding process the encoding will escape...
7
3673
by: jaja | last post by:
Hello all, I am familiar with the HtmlEncode Server method. I also read this : http://msdn2.microsoft.com/en-us/library/a2a4yykt(VS.80).aspx My question is: If I want to encode all inputs from user, can I apply this encoding for all "Input" fields on my site in a single action. Something like Input.HtmlEncodeAll() or HtmlEncodeAllInputs() etc.
0
9646
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
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
10157
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...
0
9956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8982
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 project—planning, coding, testing, and deployment—without 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
6742
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
5386
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
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.