views:

150

answers:

3

I'm testing a Tiny_MCE plugin for BlogEngine.NET extension I wrote earlier and I keep receiving the following error message whenever I use my own extension or the extremely popular SyntaxHighlighter extension which both have similar behaviors and both implement Tiny_MCE plugins:

Url : 'http://localhost/admin/Pages/Add_entry.aspx'

Raw Url : /admin/Pages/Add_entry.aspx

Message : A potentially dangerous Request.Form value was detected from the client (ctl00$cphAdmin$txtContent$TinyMCE1$txtContent="

Source : System.WebStackTrace : at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection) at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, RequestValidationSource requestCollection) at System.Web.HttpRequest.get_Form() at System.Web.HttpRequest.get_Item(String key) at BlogEngine.Core.Web.HttpModules.CompressionModule.context_PostReleaseRequestState(Object sender, EventArgs e) in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\Web\HttpModules\CompressionModule.cs:line 62 at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)TargetSite : Void ValidateString(System.String, System.String, System.Web.Util.RequestValidationSource)

My question is thus: although I receive this error on my local environment (IIS 7.5 ASP.NET 4.0 Integrated App Pool) I receive no error whatsoever on my live environment (IIS 7.5 ASP.NET 3.5 SP1/ 3.0 / 2.0.) Additionally whenever I test the extension using debug mode in Visual Studio 2010 and run the site off of a separate instance I don't receive this error.

I'm almost certain that the fact that this issue only occurs on my localhost IIS instance indicates that it's a configuration issue or a behavior specific to ASP.NET 4.0, but I don't know what exactly. Do any of you know what might be causing this?

+1  A: 

It's telling you that a control (such as a text input) is returning something that looks like HTML or javascript, and that it's not going to assume you're sanitizing your inputs.

Of course, since you are being paranoid about your inputs (you are, aren't you?) you can turn that warning off.

How to turn it off for that page:

<%@ Page Language="vb" ValidateRequest="false" [etc]

To turn it off for the whole site, put this in web.config:

<system.web>
    <pages validateRequest="false" />
    [etc.]
egrunin
I understand that - but why does it only raise this issue under this particular configuration and not the others? The codebase is the same between all of the other instances - only a connection string in the web.config file and the other IIS settings are different.
Aaronontheweb
@Aaronontheweb. Because those are not the only variations in your configuration. If you haven't specified the validateRequest=false in your web.config, it is then dependent on the settings in the (for example) enterprise.config and machine.config files for the framework version you are using.
Roger Willcocks
I went ahead and accepted this as the best answer because even though it doesn't truly address the spirit of my question, it still provides a couple of work-arounds. Thanks for your help!
Aaronontheweb
A: 

TinyMCE I believe has a way to encode the content that it submits to the server. Check that out and this message will go away. Because what @egrunin said is correct.

spinon
A: 

It is basically because , user might have posted some data in html tag form or tiny-mce is posting data in html forms. Try looking for properties that will return plain text from the editor. Also you can try above if it solves your issue.

Amit Ranjan