Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 13, 2012 02:50 PM by johnyM456
Dec 13, 2012 02:17 PM|LINK
My ASP.NET 3.5 website is logging a lot of errors. It is built using a Master Page, and the Master Page has a text box control named txtSearch that allows customers to search the website. Below is a sample error message. They are all similar to this.
It looks to me like some automated process is trying to hack the site. Can anyone confirm this is what’s happening? Is there something I can do to prevent this?
A potentially dangerous Request.Form value was detected from the client (ctl00$txtSearch="...hozdusjq, <a href="http://st-t...").
at System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName)
at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, String collectionName)
at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Dec 13, 2012 02:50 PM|LINK
If this would be an attempt to hack your site it's a poor attempt. A searchbox could be used for sql-injection, but that doesn't seem to be the case. Some idiot is just trying enter html element in the searchbox, but that's throwing an error because formvalidation
is enabled on your site.
My advice, keep formvalidation enabled as it is. If you don't want these kind of error you could do a validation on the clientside to ensure that special chars like < and > are refused before any postback is made.