Irshu
Irshu

Reputation: 8446

How to deal with string that contains "&" during the form post in asp.net?

Title=Nike+was+incorporated+on+&src=img/nike.png&body=mike&sulley+met+in

My serialized string looks something like this during the httppost. Modelbinder splits the querystring at every & symbol.For the above modelbinder recognises the querystring as

Title= Nike was incorporated on
Src= img/nike.png
body=mike
sulley= met in

But if you noticed the body shoud be mike and sulley met in. How do i tell modelbinder that sulley is not a key but the remaining value of body? I'm using mvc.

Upvotes: 1

Views: 58

Answers (1)

Softlion
Softlion

Reputation: 12615

ampersands must be encoded body=mike%26sulley+met+in

See URL data encoding in wikipedia / the rfc.

Upvotes: 1

Related Questions