CryptographicException when impersonating
Posted: Thu May 20, 2010 1:18 am
I am recieving the error: CryptographicException was unhandled. The system cannot find the path specified. This is occuring intermittenly while working with the VintasoftImage object when I am impersonating as an elevated user and also when I attempt to use the vintasoft image object after impersonating.
In the below code block it has failed in different spots during different debugging sessions. It has failed on the construction of the VintasoftImage object, the addition of the vintasoftimage object to the imaging.imagecollection, and it has also thrown the exception when setting the oImages imaging.imagecollection to nothing.
In the below code block it has failed in different spots during different debugging sessions. It has failed on the construction of the VintasoftImage object, the addition of the vintasoftimage object to the imaging.imagecollection, and it has also thrown the exception when setting the oImages imaging.imagecollection to nothing.
Code: Select all
Try
oTiffFile = New Tiff.TiffFile(strTempFileToWork)
intOriginalFilePageCount = oTiffFile.Pages.Count
oImages = New ImageCollection
AddHandler oImages.ImageSavingException, AddressOf oImages_ImageSavingException
For i As Integer = 0 To intOriginalFilePageCount - 1
oVImage = New VintasoftImage(oTiffFile.Pages(i).GetImage.GetAsBitmap, True)
oImages.Add(oVImage)
Next
blnRetValue = True
Catch ex As Exception
m_strLastError = "IsValidTifFile : Not able to Read all the pages of the tiff file " & strTiffFileNameWithPath
Finally
If oTiffFile IsNot Nothing Then oTiffFile.Dispose()
oTiffFile = Nothing
If oVImage IsNot Nothing Then oVImage.Dispose()
oVImage = Nothing
If oImages IsNot Nothing Then
RemoveHandler oImages.ImageSavingException, AddressOf oImages_ImageSavingException
oImages.Dispose()
End If
Try
oImages = Nothing
Catch ex As Exception
End Try
End Try