c# - A potentially dangerous Request.Form value was detected from the client Exception -


we have internet site on 2 servers load balance server code identical on both servers 1 of servers shows below exception every minut, "$maincontent$aspcontrol" changing each time.

a potentially dangerous request.form value detected client (ctl00$maincontent$drpownernationality="...lect'"()&%<acx><script >prompt...").   @ system.web.httprequest.validatestring(string value, string collectionkey, requestvalidationsource requestcollection)    @ system.web.httprequest.validatehttpvaluecollection(httpvaluecollection collection, requestvalidationsource requestcollection)    @ system.web.httprequest.get_hasform()    @ system.web.ui.page.getcollectionbasedonmethod(boolean dontreturnnull)    @ system.web.ui.page.determinepostbackmode()    @ system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)    @ system.web.ui.page.processrequest(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)    @ system.web.ui.page.processrequest()    @ system.web.ui.page.processrequest(httpcontext context)    @ system.web.httpapplication.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute()    @ system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously)_applicationerror, 

i think 1 of control (drpownernationality) has script..asp.net potential xss validation of inputs on form...so detecting script in 1 of controls exceptions states.

problem 1 of user of application entering script in textbox/control , not validting @ client end.

one way validation @ client end , inform users cannot enter scripts in control

other way turn off validation setting validatereqeust attribute on page false

<@ page validaterequest="false" %> 

but if have exposed application xss attacks.one way disable validation , encoding of input before processing information...

`httpserverutility.htmlencode(drpownernationality.selectedtext);` // assuming dropdown 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -