Click here to Skip to main content
15,789,776 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
private int SaveSignatureImageFile(string invNumber, string signature)
    int responce = 0;
    string filePath = string.Empty;
        byte[] bytes = Convert.FromBase64String(signature);

        Image image;
        using (MemoryStream ms = new MemoryStream(bytes))
            image = Image.FromStream(ms);
            string BasePath = WebConfigurationManager.AppSettings["DBAcknowledgementFilePath"] ?? string.Empty;
            BasePath = Path.GetFullPath(BasePath);
            filePath = BasePath + Guid.NewGuid().ToString() + "_InvoiceAck_" + invNumber + ".PNG";
            image = (Image)(ResizeImage(image, 200, 200));                   

            responce = 1;
        if (responce == 1 && filePath != string.Empty)
            int docType = FieldType(invNumber);
          //  UpdatetblUserHistLink(filePath, invNumber, "InvoiceAcknowledgement", docType);
    catch (Exception ex)
        Errorlog("Save Acknowledgement error on " + invNumber + " this invoice :" + ex.Message);
    return responce;

What I have tried:

above i write the code and How to Resolve error
Updated 11-Jan-21 23:52pm
Richard MacCutchan 12-Jan-21 4:54am    
I have had this in the past and, unfortunately, the system does not give any useful information. The best you can do is to step through the code with the debugger and see if you can spot any bad data.

1 solution

We can't tell you - we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. And this needs your code running along with your data in order to work out what exactly is going on. It could be that the string you pass in there is not a Base24 image, or that there is a problem with the save location - we don;t know, and we can't tell.

So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If you don't know how to use it then a quick Google for "Visual Studio debugger" should give you the info you need.

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900