Click here to Skip to main content
15,910,234 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Please Help Me to solve my problem


1. In Forms we have text box & button to search inside the grid

2.I called grid during pageload & also in button event.
3.in textbox if i specify <insert> and fired the button event
I got error message like "A potentially dangerous request for value was detected from the client......"

To Rectify this problem

1st Method

<%@page Validaterequest ="false"...%>
then also I am getting same problem.


2nd Method


I used Regular Expression Validator

During Regular Expression validator I solved this problem

Any other method to solve the sql injection errors

please help me to solve this problem

Thanks

Sheethal
Posted

1 solution

USE Parameters to pass the values and also StoredProcedures then u cannot affect sqlinjections.
 
Share this answer
 
Comments
smsheethal 4-May-12 8:00am    
I used parameter functions

My code like this:
cmd.parameters.Add(New sqlparameter("@search" "%" +search+"%"));

if i not use validator it will not allow go inside.

for testing please use this syntax to know the exact problem

<insert ""="">
smsheethal 4-May-12 8:01am    
I used parameter functions
My code like this:
cmd.parameters.Add(New sqlparameter("@search" "%" +search+"%"));
if i not use validator it will not allow go inside. for testing please use this syntax to know the exact problem <insert ""="">
Anil Honey 206 4-May-12 8:18am    
cmd.parameters.Add(New sqlparameter("@search" "%" +search+"%"));

this line is wrong ur not set the Properties that's why sql injection will effects.Frist u set the property for that search .Then it will work fine.
Anil Honey 206 4-May-12 8:22am    
Begin

select * from SchoolDetailsInfo where strSchoolName LIKE '%' + @SchoolName +'%'


End

u use this in stored procedure

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900