System.Security.Cryptography.ProtectedMemory

Discussion in 'ASP.NET 2.0' started by SandySears, Aug 31, 2007.

  1. Hello,

    I have an application that works fine on my development computer, but fails to compile on DiscountASP.NET. It appears that the the ProtectedMemeory class is not a member of System.Security.Cryptography on this system.

    Can anyone explain? If there is some security reason why this is so, can some suggest another way to encrypt a string of data in this service?

    Thank you in advance.

    [​IMG]

    Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30456: 'ProtectedMemory' is not a member of 'Cryptography'.

    Source Error:







    Code:
    Line 439:        Try
    Line 440:            Dim toEncrypt As Byte() = UnicodeEncoding.ASCII.GetBytes(pClearString)
    Line 441:            System.Security.Cryptography.ProtectedMemory.Protect(toEncrypt, MemoryProtectionScope.CrossProcess)
    Line 442:            Results = UnicodeEncoding.ASCII.GetString(toEncrypt)
    Line 443:        Catch ex As Exception
     

    Attached Files:

  2. Yes, that was one of the new classes added for 2.0. That line added to web.config fixed the problem.....Thank you, Vikram!
     
  3. I believe this is a new class added to the framework.Add reference to the System.Security assembly in your web.config as follows:

    <assemblies>
    <add assembly='System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' />
    </assemblies>

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page