Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » User Input Validation in ASP
Closed Thread
Old 03-09-2004, 02:46 PM   #1 (permalink)
 
True Techie

Join Date: Feb 2004

Posts: 171

Discusman is on a distinguished road

Default User Input Validation in ASP

Hi all,

I have forms and photo upload features in my website. I'm using IIS 5.1 in Windows XP Pro.

What do I need to add into my code to validate user input?
I had SQL injection attack before, now I use replace function to remove any malicious words such as SELE, DELE, Ad, etc.. to prevent SQL injection attack. Are there any other attacks which it can be triggered in a text input field? What do I need to do to prevent it?

I also have a photo upload feature, it allows user upload photos to my table and the photo will be displayed in the gallery. How can I validate the user upload file is image file only? I mean user might be able to upload malicious scripts, virus to my server. How can I prevent that?

I'm using ASPUpload software to achieve this feature.

Thanks.
Discusman is offline  
Old 03-16-2004, 08:00 PM   #2 (permalink)
 
Junior Techie

Join Date: Mar 2004

Posts: 56

raylu

Send a message via AIM to raylu
Default

Well, if you form looks like this:

Code:
{form name=form1}{input type=text name=textinp1}
{input type=button value=Upload onclick=checkupload()}{/form}
you can have JavaScript check to see what it is. I'm
I'm not too sure about this though...
Code:
{script language=javascript}{!--
function checkupload() {
if (form1.textinp1.value = "maliciousfilename.exe") {
alert("Some kinda message.")
return false
}
}
//--}{/script}
I'm not sure if that's what you want. Replace { with < and } with >.
__________________
\"Only when the last tree is dead, the last field paved, and the last river dammed, only then will we realize that we can\'t eat money.\"
http://raylu.uni.cc
raylu is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On