Asp.net MVC jQuery ajax .post weird problem: post to server sometimes?

I've encountered a pretty weird situation, I'm using Win7, VS2010, ASP.NET MVC2, jQuery. I have a simple form a textarea and a button doing a .post() ajax call to server, pretty simple setup.

It works when I input plain text in the textarea, but if I mix html tags like bold, then it works sometimes!!

I do have [ValidateInput(false)] on the action method and ValidateRequest="false" on my view, the things is that what I have does work, sometimes.

So when I debug it and mix html tag and submit, it does go into the the action method correctly, sometimes. While other times, like when not in debug, it just does not stop in the action method at all.

Very Werid! Just thought to ask if anyone else had this problem before?

Answers


It turns out that make this to work I need to have the following 3 things on my ASP.NET MVC app ready,

  • ValidateRequest="false" on the view
  • [ValidateInput(false)] on the action method
  • <httpRuntime requestValidationMode="2.0"/> on the web.config

The last thing is what I missed, I found this out by using FireBug which returned the entire asp.net Yellow Screen in html in its console.

Interesting thing is that without the last item, when you input html tags in the textarea the app should NOT work but throw some security exception, but it worked when I debugged my app which made the whole thing confusing.


Need Your Help

Liquibase db update fails saying DATABASECHANGELOGLOCK is already an existing object

liquibase

I am trying to log in as user account and create synonyms for all objects available in owner account, using liquibase changeset. I am getting below error when running the liquibase.integration.

Fatal error: Call to a member function prepare() on a non-object in C:\wamp\www\motor-house\public_html\User.class.php on line 18

php mysql pdo

I am trying to connect to the database from my Index file which has my login form. I have created an instance of the database, but I am getting an error.