ASP.NET MVC - Aktion mag JSON String 400 schlechte Anfrage nicht

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: ASP.NET MVC - Aktion mag JSON String 400 schlechte Anfrage nicht

by Anonymous » Today, 11:41

Ich habe eine Aktion, die 2 Saiten erfordert. Einer der Saiten ist eine große, hässliche JSON -Saite. Ich vermute, dass die Aktion nicht zulassen, dass die Sonderzeichen übergeben werden, da ich immer wieder eine 400 -schlechte Anfrage erhalte.public ActionResult SaveState(string file, string state)
{
string filePath = GetDpFilePath(file);
HtmlDocument htmlDocument = new HtmlDocument();
htmlDocument.Load(filePath);
HtmlNode stateScriptNode =
htmlDocument.DocumentNode.SelectSingleNode("/html/head/script[@id ='applicationState']");
stateScriptNode.InnerHtml = "var applicationStateJSON =" + state;
htmlDocument.Save(filePath);

return null;

}
< /code>
Clientscript < /p>
'e' is a large json string

$.post('/State/SaveState/' + fileName+'/' + '/' + e + '/');
< /code>
Ich codiere jetzt den Text mit Uriencoding (), aber es macht keinen Unterschied. Ich glaube nicht, dass MVC -Aktionen es mir ermöglichen, diese Sonderzeichen standardmäßig zu senden. Ist das wahr? Wie arbeiten Sie damit um? URL: http: // localhost: 51825/state/savestate/aa6282.html //%7b%22Uid%22%3a%22Testuser%22%2C%22A

Top