473,326 Members | 2,095 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,326 software developers and data experts.

Asp form filtering

Hi,

I'm looking for an asp page to detect if there are any characters in my
contact form that shouldn't be there. For example, if there is a "<"
character, then this may mean there is html in my contact form, which
is not good. I want to build a string that has all the values of my
textboxes in my contact form. Its not working? Have a look:
<%

'Declare all the variables and assign them to their respective text
inputs on the feedback.asp page

dim formall : request.Form("x_name") + request.Form("x_email") +
request.Form("x_subject") + request.Form("x_comments")
'Use the In-String Function to detect on html open or close tags found
in the input boxes. If so, Don't send e-mail

if (Instr(formall,">")) OR (Instr(formall, ";")) Then

response.redirect("test2.html") 'Just a test
end if

%>


If anyone can help, it would be good!!
jf

Jul 28 '05 #1
4 1984
Why don't you do this with client-side JavaScript, before the submit? You
can use regular expressions there and you will prevent (a) server activity
and (b) the user having to wait for the submission to be rejected by the
server.

What is wrong with semi-colon (;), btw?
"jfancy-Transport Canada" <ju*********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,

I'm looking for an asp page to detect if there are any characters in my
contact form that shouldn't be there. For example, if there is a "<"
character, then this may mean there is html in my contact form, which
is not good. I want to build a string that has all the values of my
textboxes in my contact form. Its not working? Have a look:
<%

'Declare all the variables and assign them to their respective text
inputs on the feedback.asp page

dim formall : request.Form("x_name") + request.Form("x_email") +
request.Form("x_subject") + request.Form("x_comments")
'Use the In-String Function to detect on html open or close tags found
in the input boxes. If so, Don't send e-mail

if (Instr(formall,">")) OR (Instr(formall, ";")) Then

response.redirect("test2.html") 'Just a test
end if

%>


If anyone can help, it would be good!!
jf

Jul 28 '05 #2
Use Regular Expressions (RegEx), the following has code you can adapt to
your use.

#2344: How do I highlight words in a string?
http://aspfaq.com/show.asp?id=2344

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"jfancy-Transport Canada" <ju*********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,

I'm looking for an asp page to detect if there are any characters in my
contact form that shouldn't be there. For example, if there is a "<"
character, then this may mean there is html in my contact form, which
is not good. I want to build a string that has all the values of my
textboxes in my contact form. Its not working? Have a look:
<%

'Declare all the variables and assign them to their respective text
inputs on the feedback.asp page

dim formall : request.Form("x_name") + request.Form("x_email") +
request.Form("x_subject") + request.Form("x_comments")
'Use the In-String Function to detect on html open or close tags found
in the input boxes. If so, Don't send e-mail

if (Instr(formall,">")) OR (Instr(formall, ";")) Then

response.redirect("test2.html") 'Just a test
end if

%>


If anyone can help, it would be good!!
jf

Jul 28 '05 #3
Have you considered allowing those characters and just Server.HtmlEncode'ing
the strings whenever you need to display them?

Ray at work

"jfancy-Transport Canada" <ju*********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,

I'm looking for an asp page to detect if there are any characters in my
contact form that shouldn't be there. For example, if there is a "<"
character, then this may mean there is html in my contact form, which
is not good. I want to build a string that has all the values of my
textboxes in my contact form. Its not working? Have a look:
<%

'Declare all the variables and assign them to their respective text
inputs on the feedback.asp page

dim formall : request.Form("x_name") + request.Form("x_email") +
request.Form("x_subject") + request.Form("x_comments")
'Use the In-String Function to detect on html open or close tags found
in the input boxes. If so, Don't send e-mail

if (Instr(formall,">")) OR (Instr(formall, ";")) Then

response.redirect("test2.html") 'Just a test
end if

%>


If anyone can help, it would be good!!
jf

Jul 28 '05 #4
jfancy-Transport Canada wrote:
I'm looking for an asp page to detect if there are any characters in
my contact form that shouldn't be there. For example, if there is a
"<" character, then this may mean there is html in my contact form,
which is not good. I want to build a string that has all the values
of my textboxes in my contact form.


What's wrong with a user submitting any character that pleases him? I
suggest you familiarize yourself with Server.HTMLEncode.

http://msdn.microsoft.com/library/en...f4ee5853a7.asp

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 28 '05 #5

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

Similar topics

2
by: Dalan | last post by:
Okay, I have worked on this and then some, but cannot seem to crack it. So if someone can straighten my code out, or suggest a new approach, then I'm all ears. Here goes: I have two tables - one...
0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
5
by: glamster7 | last post by:
Hi Folks, I have a form frm.viewbookings which shows in the header the labels Stylist1 through to Stylist 7 with the stylist names underneath them. In total for the set of data I have there are...
0
by: Lyn | last post by:
I have a problem using the form .Filter and .FilterOn properties which causes Access to crash (as detailed in a separate post). The form operates in continuous mode, displaying matching records...
7
by: DeZZar | last post by:
Hi all, Unfortunately I am quite a novice with Access!! I've created a number of data bases for my work however becuase my skills are limited to really built in functionality and wizards my...
3
NeoPa
by: NeoPa | last post by:
Cascaded Form Filtering CHAPTER 1 - TABLE OF CONTENTS (Including attached database) CHAPTER 2 - INTRODUCTION CHAPTER 3 - TABLE LAYOUT CHAPTER 4 - FORM LAYOUT CHAPTER 5 - FORM MODULE CHAPTER 6...
5
f430
by: f430 | last post by:
i have a search form that filters a master table, my vba code is complete and is correct, the only problem i am facing is that after i search my filter tells me at the bottom of the form how many...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.