473,396 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Add slashes in Request.Form.

How to add slashes for the each element in the incoming Request.Form

I tried:
for (int i = 0; i < Request.Form.Count; i++)
{
Request.Form[i]. = Request.Form[i].Replace("'",
"\\'").Replace("\"", "\\\"");
}

But it causes an error and showing Request.Form is an read-only
attributes......
Jul 10 '07 #1
4 1970
You can't change the incoming HTTP request. Your best bet would be likely to
make this change where those values are consumed. You may want to explain
what you are trying to do...

--
Patrice

"LamSoft" <[nospam]la*****@lamsoft.neta écrit dans le message de news:
et**************@TK2MSFTNGP05.phx.gbl...
How to add slashes for the each element in the incoming Request.Form

I tried:
for (int i = 0; i < Request.Form.Count; i++)
{
Request.Form[i]. = Request.Form[i].Replace("'",
"\\'").Replace("\"", "\\\"");
}

But it causes an error and showing Request.Form is an read-only
attributes......

Jul 10 '07 #2
"LamSoft" <[nospam]la*****@lamsoft.netwrote in message
news:et**************@TK2MSFTNGP05.phx.gbl...

That's right - Request.Form is read-only...

What are you trying to achieve with this...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 10 '07 #3
The value are going to insert into mySQL Server

So it needs to be escaped......

How can I do this?
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:Og**************@TK2MSFTNGP02.phx.gbl...
"LamSoft" <[nospam]la*****@lamsoft.netwrote in message
news:et**************@TK2MSFTNGP05.phx.gbl...

That's right - Request.Form is read-only...

What are you trying to achieve with this...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 11 '07 #4
"LamSoft" <[nospam]la*****@lamsoft.netwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
The value are going to insert into mySQL Server

So it needs to be escaped......

How can I do this?
Use parameterised queries or a stored procedure:
http://www.google.co.uk/search?sourc...eterized+query
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 11 '07 #5

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

Similar topics

1
by: Sugapablo | last post by:
Ok. I have a web form with text fields. When the form is submitted, it goes to a php page to insert into a Postgres DB. Example: pg_query($db,"INSERT INTO table VALUES = ('" ....
3
by: Randell D. | last post by:
Folks, I'm using Apache/1.3.28 (SuSE 7.1, kernal 2.4) with PHP/4.3.2. I have the following code to help cleanse form data. function cleanData($sourceData, &$cleanData) { foreach($myData as...
13
by: lawrence | last post by:
A user writes this sentence: "It was the New Urbanist's nightmare of sprawl run amok." They input that and my PHP script hits it with addslashes() and then the sentence gets put in the database....
16
by: droog | last post by:
Hello! I have just started learning python and encountered a problem. All I wanted to do, was to open a text file search and count the number of occurances of a single word and print that count....
10
by: Carlos Ribeiro | last post by:
Hello all. I'm sending this to the list because I would like to know if someone else has ever stumbled across this one, and also because one possible solution is to patch, or simply "decorate",...
4
by: bdwise | last post by:
I have a textbox in a form, and I need to allow users to enter dates in US Format (MM/DD/YYYY). But they do not want to type any slashes, just 8 numbers, and have the slashes added for them. ...
2
by: Nils N | last post by:
Is there anyone her who knows how to use slashes as querystring. What I want to do is using the url: http://localhost/urltest/?id=23423ea342 to appear as http://localhost/urltest/23423ea342...
2
by: StevePBurgess | last post by:
Ok. I have checked the magic quotes is on. I have a form on my web page. The input from this is sent (by POST) to the server. A PHP script processes it. If there any errors the input is urlencoded...
8
by: mijn naam | last post by:
Trying to find info about this, but searching for '///' or for 'tripple slash' doesn't provide relevant answers. Can anyone please point me in the right direction? A simple script, called...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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,...

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.