Friday, 15 May 2015

c# - How Ajax post large data to asp.net web form webMethod -



c# - How Ajax post large data to asp.net web form webMethod -

i trying send image using ajax post asp.net web form

function submitfunction() { alert(imgdata_based64string); imgdata_based64string = "test"; $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "webform1.aspx/saveimage", data: "{ 'based64binarystring' :'" + imgdata_based64string + "'}", datatype: "json", success: function (data) { }, error: function (result) { alert("error"); } }); } [system.web.services.webmethod] public static void saveimage(string based64binarystring) { string value = based64binarystring; }

everything ok."test" message arrived server side saveimage function. when tried send actual based64string (after removing "test" dummy message)

data:image/png;base64,ivborw0kggoaaaansuheugaaaoaaaahgcayaaaa10 ....

it never reach server side saveimage function. show below error @ browser developer mode.

failed load resource: server responded status of 500 (internal server error)

finally can solve it, after getting help link.

<configuration> <system.web.extensions> <scripting> <webservices> <jsonserialization maxjsonlength="50000000"/> </webservices> </scripting> </system.web.extensions> </configuration>

c# jquery asp.net ajax http-post

No comments:

Post a Comment