taz8020
asked on
I get System.Web.HttpRequestValidationException
Hi to make sure uses dont get error i have added code to email me if an error occurs and i keep getting a System.Web.HttpRequestVali dationExce ption but when I test all seems fine.
Please help me fix it.
this is the email i get:
-------------------------- ---------- ---------- ---------
URL: /default.aspx
User:
Exception Type: System.Web.HttpRequestVali dationExce ption
Message: A potentially dangerous Request.Form value was detected from the client (ctl00$LogInHeader1$QuickS earch1$Tex tBoxQuickS earch="... oh/dp/vl,
Stack Trace: at System.Web.HttpRequest.Val idateStrin g(String value, String collectionKey, RequestValidationSource requestCollection)
at System.Web.HttpRequest.Val idateNameV alueCollec tion(NameV alueCollec tion nvc, RequestValidationSource requestCollection)
at System.Web.HttpRequest.get _Form()
at System.Web.HttpRequest.get _Item(Stri ng key)
at Telerik.Web.UI.RadCompress ion.IsAjax Request()
at Telerik.Web.UI.RadCompress ion.Compre ss(HttpApp lication application)
at System.Web.HttpApplication .SyncEvent ExecutionS tep.System .Web.HttpA pplication .IExecutio nStep.Exec ute()
at System.Web.HttpApplication .ExecuteSt ep(IExecut ionStep step, Boolean& completedSynchronously)
Please help me fix it.
this is the email i get:
--------------------------
URL: /default.aspx
User:
Exception Type: System.Web.HttpRequestVali
Message: A potentially dangerous Request.Form value was detected from the client (ctl00$LogInHeader1$QuickS
Stack Trace: at System.Web.HttpRequest.Val
at System.Web.HttpRequest.Val
at System.Web.HttpRequest.get
at System.Web.HttpRequest.get
at Telerik.Web.UI.RadCompress
at Telerik.Web.UI.RadCompress
at System.Web.HttpApplication
at System.Web.HttpApplication
ASKER
Hi, no it not when i am testing it but get the same message about 20-30 times a day.
What i dont understand, is when the search button is pressed i remove all non allowed characters. so it should then read oh+dp+vl
What i dont understand, is when the search button is pressed i remove all non allowed characters. so it should then read oh+dp+vl
>when the search button is pressed i remove all non allowed characters.
Using Javascript?
Using Javascript?
ASKER
No on the asp.net clickevent, why should i do it via java?
Because the error is raised when textbox content is received by asp.net and it contains html at that point.
ASKER
So how would you do it in JavaScript? I take it you would do it on the on click event by will that fire before the vb function runs. Please help
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Hi I need to do it more like this, but not working any ideas?
<script type="text/javascript">
function RemoveNonAllowedChar(sende r) {
var newValue = sender.value.replace(/[^a- zA-Z0-9]/g , '+');
sender.value = newValue;
}
</script>
<script type="text/javascript">
function RemoveNonAllowedChar(sende
var newValue = sender.value.replace(/[^a-
sender.value = newValue;
}
</script>
Are you calling this function in button's OnClientClick? If you try the code in the link, does that work?
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for taz8020's comment #a39309859
for the following reason:
Thanks did it on the blur event
Accepted answer: 0 points for taz8020's comment #a39309859
for the following reason:
Thanks did it on the blur event
Are you using the page yourself when the error comes up? What do you put in the textbox? Its complaining about values in that textbox which may appear to be html, script etc.