Click here to Skip to main content
15,888,341 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: A CSS Question Pin
Roger Wright26-May-12 7:35
professionalRoger Wright26-May-12 7:35 
Questionfix row and column in html table Pin
Member 897905824-May-12 19:41
Member 897905824-May-12 19:41 
AnswerRe: fix row and column in html table Pin
Richard MacCutchan24-May-12 22:42
mveRichard MacCutchan24-May-12 22:42 
GeneralRe: fix row and column in html table Pin
Member 897905824-May-12 22:50
Member 897905824-May-12 22:50 
GeneralRe: fix row and column in html table Pin
Richard MacCutchan24-May-12 23:28
mveRichard MacCutchan24-May-12 23:28 
GeneralRe: fix row and column in html table Pin
Member 897905824-May-12 23:33
Member 897905824-May-12 23:33 
GeneralRe: fix row and column in html table Pin
Richard MacCutchan24-May-12 23:39
mveRichard MacCutchan24-May-12 23:39 
GeneralRe: fix row and column in html table Pin
Member 897905824-May-12 23:47
Member 897905824-May-12 23:47 
GeneralRe: fix row and column in html table Pin
RichardGrimmer7-Sep-12 1:50
RichardGrimmer7-Sep-12 1:50 
GeneralRe: fix row and column in html table Pin
Richard MacCutchan12-Sep-12 3:38
mveRichard MacCutchan12-Sep-12 3:38 
QuestionProblem ModalPopupExtender and UpdatePanel Pin
papy-boom22-May-12 7:05
papy-boom22-May-12 7:05 
AnswerRe: Problem ModalPopupExtender and UpdatePanel Pin
Sandeep Mewara25-May-12 17:56
mveSandeep Mewara25-May-12 17:56 
QuestionUsing CSS Pin
Mary Abraham22-May-12 5:19
Mary Abraham22-May-12 5:19 
AnswerRe: Using CSS Pin
Sandeep Mewara25-May-12 17:46
mveSandeep Mewara25-May-12 17:46 
AnswerRe: Using CSS Pin
Roger Wright25-May-12 21:58
professionalRoger Wright25-May-12 21:58 
GeneralRe: Using CSS Pin
User 171649225-May-12 22:32
professionalUser 171649225-May-12 22:32 
GeneralRe: Using CSS Pin
Roger Wright26-May-12 5:54
professionalRoger Wright26-May-12 5:54 
QuestionDesigning WCF Pin
byka21-May-12 4:56
byka21-May-12 4:56 
QuestionModal PopUp extender Pin
berba21-May-12 2:33
berba21-May-12 2:33 
AnswerRe: Modal PopUp extender Pin
frostcox25-May-12 11:05
frostcox25-May-12 11:05 
AnswerRe: Modal PopUp extender Pin
Sandeep Mewara25-May-12 18:01
mveSandeep Mewara25-May-12 18:01 
QuestionJohn Ray still relevant? (TCP/IP related) Pin
Mossmyr21-May-12 1:24
Mossmyr21-May-12 1:24 
QuestionNot able to Ajax post knockout (KO) data in XML format Pin
AumSingh20-May-12 6:38
professionalAumSingh20-May-12 6:38 
I am working on .NET 4.0 MVC project. I am trying to Ajax post a piece of data from my KO model. That data is a string in following XML format.

HTML
<SearchCriteria><Criteria SearchOn="Name" SearchValue="test 3" /></SearchCriteria>


I am trying to post it like this.

JavaScript
$.ajax({
        url: destUrl,
        data: ko.toJSON(DataToPost()),
        type: "POST",
        success: function (result) {
            // I am doing my stuff here.
            }
        },
        error: function (request, textStatus, errorThrown) {
            alert(request.statusText);
        }
    });


Here you will notice the data being sent is "ko.toJSON(DataToPost())". DataToPost() returns the XML string contained in my KO model data member DataToPost. ko.toJSON() is used to convert the KO model data in JSON.

This throws a runtime exception which is normally thrown when we post anything containing javascript or html tags. This is a security feature by .NET. Following is the exception.

HTML
A potentially dangerous Request.Form value was detected from the client.

<SearchCriteria><Criteria SearchOn="...est 3\" /></SearchCriteria>


I faced similar situation sometimes back (though I was not using KO that time and it was normal post i.e. non Ajax). I overcame the problem that time by using javascript escape() but this time it failed. I used it as follows
JavaScript
$.ajax({
        url: destUrl,
        data: ko.toJSON(escape(SearchCriteria())),
        type: "POST",
        success: function (result) {
            // I am doing my stuff here.
            }
        },
        error: function (request, textStatus, errorThrown) {
            alert(request.statusText);
        }
    });


Other popular fix is to disable this security either at page level or at application level. It could be done as follows.

Page level.

C#
<%@ Page validateRequest="false" %> 


Application level.

HTML
<configuration>
   <system.web>
      <pages validateRequest="false" />
   </system.web>
</configuration>


But doing away with this security is not good. I don't think it will be a wise move. Right now I don't know what to do. Need suggestions.

Thanks in advance!
AnswerRe: Not able to Ajax post knockout (KO) data in XML format Pin
AumSingh23-May-12 23:52
professionalAumSingh23-May-12 23:52 
Questiontigrina lexikon ትግርኛ መዝገብ ቃላት seglelet.com Pin
mululer19-May-12 22:27
mululer19-May-12 22:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.