Click here to Skip to main content
11,930,788 members (55,398 online)
Rate this:
Please Sign up or sign in to vote.
See more: jQuery JSON WebService
I am trying to save Base64 data in to database.
But I am not able to send dataUrl to my .asmx file.

function UploadUserPhoto() {                
    var Mycanvas = document.getElementById("tempCanvas");
    var dataURL = Mycanvas.toDataURL("image/png");               
        url: "LP18WS.asmx/UploadPhoto",
        contentType: "application/json; charset=utf-8",
        data: {
            Base64String: "\'" + dataURL + "\'"
        dataType: "json",
        success: function (msg) {
        error: function (msg) {
            alert(msg + '\n' + xhr.responseText);
Webservice (LP18WS.asmx)
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json,  UseHttpGet = true)]
public string UploadPhoto(string Base64String)
   string message = "";
    //code to save data url in database            
   return message;
But it is not sending the dataurl. If I put some other string instead of dataurl it is working.
Why this dataurl can't send?. Can any one guid me?

I have observed that it is happening when there are large amount of data within dataURL. Otherwise when the amount of data is minimum it is working. Can you give me a solution to overcome this situation.
Posted 25-Apr-13 2:56am
Edited 25-Apr-13 6:13am
Prasad Khandekar 25-Apr-13 11:15am
Don't use GET, use Post to sending large data. Query string length is generally limited to few kbs.
SHAJANCHERIAN 27-Apr-13 9:46am
Thank you. Its working..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 25 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100