.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

System.Security.Cryptography.CryptographicException: The system cannot find the file specified

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :.NET Framework




When i tried to use a third party web service  using IIS  , i am getting the following Error

Exception Details: System.Security.Cryptography.CryptographicException: The system cannot find the file specified.

[CryptographicException: The system cannot find the file specified.
   System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer) +1459868
   System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle) +55
   System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair() +79
   System.Security.Cryptography.RSACryptoServiceProvider.ExportParameters(Boolean includePrivateParameters) +38
   System.Security.Cryptography.RSA.ToXmlString(Boolean includePrivateParameters) +41
   Globeranger.EdgeServices.Security.Runtime.Client.ClientSession.a() +158
   Globeranger.EdgeServices.Security.Runtime.Client.ClientSession.RequestLogin(String reasonMessage) +200
   Globeranger.EdgeServices.Security.Runtime.Client.ClientSession.GetNewSecureSessionToken(Boolean attemptLogin) +148

View Complete Post

More Related Resource Links

System.Security.Cryptography.CryptographicException (BAD DATA)

Can anyone help me out in this issue ? Any help will be appreciated Stack Trace: <?xml version="1.0" encoding="utf-16"?>   <error    host="localhost"    type="System.Security.Cryptography.CryptographicException"     message="Bad Data.&#xD;&#xA;"     source="mscorlib"     detail="System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown.  System.Exception: Bad Data.&#xD;&#xA; System.Security.Cryptography.CryptographicException: Bad Data.&#xD;&#xA;&#xD;&#xA;   at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)&#xD;&#xA;   at System.Security.Cryptography.Utils._DecryptData(SafeKeyHandle hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]&amp; outputBuffer, Int32 outputOffset, PaddingMode PaddingMode, Boolean fDone)&#xD;&#xA;   at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)&#xD;&#xA;   at System.Security.Cryptography.CryptoStream.FlushFinalBlock()&#xD;&#xA;  CODE:   public static string Decrypt(string stringToDecrypt, string sEncryptionKey)         {    &

Intermittent CryptographicException "The system cannot find the file specified."




I'm writing custom web application running on MOSS 2007 (running on Windows Server 2008 R2) with Kerberos setup.

In my code, I'm calling a 3rd party library which internally doing a signing of a string.

Intermittently in production environment, user encounter error message. When I check on the error log, I saw CryptographicExceptions with message "The system cannot find the file specified."


	Inner Exception
	Type : System.Security.Cryptography.CryptographicException, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089
	Message : The system cannot find the file specified.

	Source : mscorlib
	Help link : 
	Data : System.Collections.ListDictionaryInternal
	TargetSite : System.Security.Cryptography.SafeProvHandle CreateProvHandle(System.Security.Cryptography.CspParameters, Boolean)
	Stack Trace :  at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
	  at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
	  at System.Security.Cryptography.DSACryptoServiceProvider.GetKeyPair()
	  at xx.xxxx.SecurityController.signData(Byte[] message)
	  at xx.xx

Encryption (System.Security.Cryptography) .Net 2.0

Hi, Query regarding cryptography.  I'm using .net cryptography to encrypt and decrypt files stored on disk on an asp.net website using .Net 2.0 framework.   The code (copied below) works fine to encrypt and decrypt pdf, tif, jpg, etc.  However when it comes to MS Word documents with embedded images and/or tables I get a "Bad data" error when decrypting.   The same document saved to rtf format is encrypted and decrypted without error.  Also simple formatted text documents in Word format (Office 2003) do not throw an error when being decrypted. Would someone care to point out where I'm going wrong? Thanks, code below   _________________________________    Public Sub Encrypt(ByVal Userid As Integer, ByVal FilePath As String)        'Encrypt the file        Try            Dim EncryptedFilePath As String = FilePath & "enc"            Dim clsNetEnCrypt As New NetEncrypt(User)            clsNetEnCrypt.Encrypt(FilePath, EncryptedFilePath)            'Remove the Unencrypted file  

Error: 0x80070002 The system cannot find the file specified

From Windows Server 2003 Std Ed SP, 32 bit VMWare Virtual Server .Net Framework v1.1.4322 When attempting to run a hello world aspx page it fails to load returning the message "Server Application Unavailable".  The application even viewer logged the following: Event Type: ErrorEvent Source: ASP.NET 1.1.4322.0Event Category: NoneEvent ID: 1088Description:Failed to execute request because the App-Domain could not be created. Error: 0x80070002 The system cannot find the file specified. I tried to run aspnet_regiis.exe -i, rebooted but this did not work. I tried to uninstall, reboot, reinstall .net from the Windows component section of Add/Remove Programs. Does anybody have any ideas? thanks, MP

The process could not be created for step 1 of job .....(reason: The system cannot find the file spe


Hi ,

I was trying your options by using "(operating system) cmdExec" to delete folders which were 15 days olders.  But here i am getting error if i look into view history of sql agent job... below is my command that i gave in Job step.

EXEC xp_cmdshell 'forfiles /p "z:\backup" -d 15 /c "cmd /c if @isDir==True echo RD /Q /S @FILE&RD /Q /S @FILE"'

And the error is :

The process could not be created for step 1 of job .....(reason: The system cannot find the file specified).  The Step failed.

but if i give this command in New Query Window, i am able to delete the folders successfully.

Please advice me if am wrong

R Anand

Could not load file or assembly 'vcWebCore' or one of its dependencies. The system cannot find the

I have a web project that references a strong-name DLL which contains a HttpModule, it is called vcWebCore.dll.

The DLL is registered in GAC using the gacutil.exe and everything looks fine.
I can see the DLL in my c:\windows\assembly directory with the correct
version ( and public key token.

However, at runtime I kept getting the error that the vcWenCore module could not be located:

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'vcWebCore' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 16: 	<system.web>
Line 17: <httpModules>
Line 18: <add type="Technesis.vcWebCore.Web.VcHttpModule, vcWebCore" name="VcHttpModule" />
Line 19: </httpModules>
Line 20: <!--
Does anyone know why or what I am missing?

P.S. If I have the DLL in the bin folder ev

System.EnterpriseServices.dll' because of system error: The system cannot find the file specified.




Can anyone help in resloving this problem I get during the .Net 2.0 Frameworks distribution ?

Thanks in advance!

MSI (s) (7C:A4) [09:33:28:295]: Executing op: ActionStart(Name=CA_InstallAssemblyRB.3643236F_FC70_11D3_A536_0090278A1BB8,,)
11/24/06 09:33:28 DDSet_Exit: InstallAssembly ended with return value 0
MSI (s) (7C:A4) [09:33:28:310]: Executing op: CustomActionSchedule(Action=CA_InstallAssemblyRB.3643236F_FC70_11D3_A536_0090278A1BB8,ActionType=1281,Source=BinaryData,Target=UninstallAssembly,CustomActionData=System.EnterpriseServices,Version=,PublicKeyToken=b03f5f7f11d50a3a,Culture=neutral,ProcessorArchitecture=x86;258048)
MSI (s) (7C:A4) [09:33:28:310]: Executing op: ActionStart(Name=CA_InstallAssemblyDef.3643236F_FC70_11D3_A536_0090278A1BB8,,)
MSI (s) (7C:A4) [09:33:28:310]: Executing op: CustomActionSchedule(Action=CA_InstallAssemblyDef.3643236F_FC70_11D3_A536_0090278A1BB8,ActionType=1025,Source=BinaryData,Target=InstallAssembly,CustomActionData=c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll;258048)
MSI (s) (7C:80) [09:33:28:310]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI1D.tmp, Entrypoint: InstallAssembly
11/24/06 09:33:28 DDSet_Status: LANGID: 1033
11/24/06 09:33:28 DDSet_Entry: InstallAssembly started
11/24/06 09:33:28 DDSet_Status: CustomActionData: c

How to Serialize System.Security.Cryptography objects?



I'm creating a solution for a multi-webserver farm that basically receives and stores files for remote users.  The files arrive at our load balancer in small, HTTPS encrypted chunks that can be anywhere from 1k to >1024k in size, and typically represent a fraction of the overall file being received.

After all the chunks have been received, but before storing the file, we create a sha1 hash of the file just sent in by the user.  If it already matches the hash of something in storage, we merely store a pointer to the originally stored file, instead of storing another copy.

(For reasons outside the scope of this discussion, the client is incapable of computing the hash on its own, and must sent the file to the server).


The Problem:

The "chunk-storage" infrastructure is sufficiently distributed that a given stream of chunks can be processed on any number of web servers.  The same is true of the ASP Session variable, which is stored on a SQL cluster in the farm, so any web server can pick up where a prior server's session left off.

The SHA1 computation, however, currently runs after receiving the last chunk of data, which creates an unnecessary I/O spike and delay in deciding whether or not to commit the file to storage or use a pointer:  The whole file is retrieved from stor



hello i have the following problem

i have upload my content to hosting server but i get the following error

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of typ

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPerm


Good Day all,

Having an issue with an outside user accessing my IIS7 box. I do not have this problem when running the website from my host machine. I found this post: Http://forums.asp.net/t/1371394.aspx. I assure you that this is not a solution because I am not storing any of my files on a network share. 

What do you think my approach should be. 

I already have read rights to IIS user to my BIN folder. 

Thanks for the help. 

Compiler Error Message : CS0006: Metadata file 'System.EnterpriseServices.dll' could not be found


I get this error when i Debug my web application....


I followed these steps.,

  • Ended the aspnet_wp.exe process in the Windows Task Manager
  • Then deleted the application`s folder in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
  • Then started Visual Studio 2008 again

I also rebooted my system but no use....

Plz help !

NTFS: Enhance Your Apps With File System Transactions


Presented here is an overview of Transactional NTFS and how it revolutionizes transactions.

Jason Olson

MSDN Magazine July 2007

Code Name WinFS: Revolutionary File Storage System Lets Users Search and Manage Files Based on Conte


One of the monumental problems organizations face today is aggregating information that's stored in disparate formats. Knowledge workers have long wanted to be able to search for content independent of format. The next version of the Windows operating system, code-named "Longhorn," boasts a new storage subsystem that makes that task easier. That subsystem, code-named "WinFS," allows the user to perform searches based on the metadata of the stored item, regardless of what type of file it is or which application created it. This article covers the basic architecture of WinFS and explains how to use the WinFS managed API.

Richard Grimes

MSDN Magazine January 2004

Windows Server 2003: Discover Improved System Info, New Kernel, Debugging, Security, and UI APIs


There's a lot to say about Windows Server 2003. First of all, it's the first operating system with built-in .NET Framework support, and it's the first 64-bit OS from Microsoft. But wait, there's more! There are lots of new features and APIs in this version as well. For instance, Windows Server 2003 features Hot Add Memory and a number of other arcane new tidbits. There are new APIs for handling threads, directories, and files, and new features like the low fragmentation heap for managing memory and system information. There's vectored exception handling and new UI APIs as well.OS internals expert Matt Pietrek takes a look at the additions he finds most interesting and useful so you'll have a good place to start when you dive into Windows Server 2003.

Matt Pietrek

MSDN Magazine June 2003

Build an Easy Maintenance Intranet Site: Using Office Docs, File System Object, and OLE Structured S


If you've ever needed to build an easy-to-maintain intranet site, here's a solution based on Microsoft Office documents. Many sites require constant updating of their HTML, but the use of Word documents can simplify the process. This article details the construction of a human resources site that exploits the File System Object (FSO), OLE Structured Storage, and ActiveX capabilities of Word documents. This allows the HR staff to copy their revised or newly created Word files to the site, dynamically generate a list of links to their files, and free IS from the constant recoding of HR updates into new HTML pages.

Josef Finsel

MSDN Magazine March 2000

Video: SharePoint 2010 File System

This video describes the SharePoint 2010 file system and integration with Visual Studio 2010. (Length: 3:23)
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend