views:

76

answers:

1

I m making an ajax call using jQuery to an asp.net page which acts as my ajax server page to save the data which i am sending to it in the querystring. in the asp.net page when i am trying to read the querystring i am getting this error

A potentially dangerous Request.QueryString value was detected from the client...

I have set the ValidateRequest="false" in my page.Dont want to set it for all the pages.So did it in page level instead of config level

  var content = "<h3>Sample header</h3><p>sample para</p>"
  content = encodeURIComponent(content);
  var url = "../Lib/ajaxhandler.aspx?mode=savecontent&page=home&ltxt=" + content;

     $.post(url, function (data) { 
       //check return value and do something
   });

and in my asp.net page

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ajaxhandler.aspx.cs" ValidateRequest="false" Inherits="MyProject.Lib.ajaxhandler" %>

But when i am sending plain text instead of the html markup,It works fine

+2  A: 

If this is ASP.NET 4, there was a breaking change with ValidateRequest. See this StackOverflow question for more information on requestValidationMode.

Forgotten Semicolon
Oh Yes.This problem came when i upgraded my framework version to 4.0.it worked with 2.0 yesterday.
Shyju