Free Support Forum -

The system cannot find the file specified

Urgent Request.

I am scheduled to go live within days have been sucessfully testing digital signatures with Pdf Kit on local development. Upon moving to test server prior to deployment I get this error: "The system cannot find the file specified" when instantiating Certificate object: "myCert = new Certificate(certPath, encPwd);"

Test server is Server2003, development machine running Win7

Have tried eval license with explicit declare as change.

This message was posted using Aspose.Live 2 Forum

Hi Fred,

I’m afraid, the error message doesn’t say much about the cause of this issue. Please try to make sure that the path to the certificate file is correct. If it still cause the same problem at your end then please share a small sample application with us, which can reproduce the same issue at our end. We’ll investigate it in detail and you’ll be updated accordingly.

We’re sorry for the inconvenience.

The inner exception revealed the source of the error was the System Crypto class. The certificate was being located and read in using the code below:

certPath = Server.MapPath("../Certs/" + Context.User.Identity.Name + ".pfx");

try{myCert = new Certificate(certPath, encPwd);}

catch (Exception ex){lblError.Text = certPath + " -- " + ex.Message;lblError.Visible = true;return;}

I could determine the cert was being read because if an incorrect password was entered, it failed for the same reason on this server as it did on my local development machine. I was able to get this work on a Win7 another machine if I set the ApplicationPool to run as Network Service but this did not work on the Server2003 machine. Finally I found this post:

And inparticular, this single line of code: RSACryptoServiceProvider.UseMachineKeyStore = true;
This resolved the issue.

Hi Fred,

We're glad to know that this issue is resolved at your end. If you find any further questions or concerns, please do let us know.