Click here to Skip to main content
11,795,848 members (78,436 online)
Rate this: bad
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 1:56am
Edited 25-Apr-13 5:13am
(no name)49.8K
Prasad Khandekar at 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 at 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
0 Maciej Los 350
1 Sergey Alexandrovich Kryukov 326
2 KrunalRohit 239
3 Andy Lanng 236
4 OriginalGriff 230
0 OriginalGriff 1,852
1 Maciej Los 1,465
2 KrunalRohit 1,300
3 CPallini 840
4 Richard MacCutchan 828

Advertise | Privacy | Mobile
Web03 | 2.8.151002.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