« Previous Next »

Thread: Need Help on iis + DataProtect.Protect

Last post 03-29-2009 6:14 AM by Leo Tang - MSFT. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 03-23-2009, 3:09 PM

    • chobo2
    • Not Ranked
    • Joined on 08-05-2007, 3:30 AM
    • Posts 26

    Need Help on iis + DataProtect.Protect

    Hi

    I have a private key that I am storing in a file. As added security I am using 

     ProtectedData.Protectkey, null, DataProtectionScope.CurrentUser);

     

    Server Error in '/' Application. The system cannot find the file specified. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Security.Cryptography.CryptographicException: The system cannot find the file specified. Source Error: Line 24: Line 25: // protect the key Line 26: key = ProtectedData.Protect(key, null, DataProtectionScope.CurrentUser); Line 27: Line 28: Source File: e:\domains\interactivejapanese.com\wwwroot\mytest101\App_Code\generateEncryption.cs Line: 26 Stack Trace: [CryptographicException: The system cannot find the file specified. ] System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) +453 EncryptedPayPal_API_Credentials.generateEncryption.GenerateKey(String targetPath) in e:\domains\interactivejapanese.com\wwwroot\mytest101\App_Code\generateEncryption.cs:26 Encryptor.btn_generate_Click(Object sender, EventArgs e) in e:\domains\interactivejapanese.com\wwwroot\mytest101\Encryptor.aspx.cs:22 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

     

    So I been told I need admin privileges to access what is needed to use protectedData.Scope. So is there nothing in IIS that does the same thing where I do not need these privileges since I can't get admin rights.

  • 03-29-2009, 6:14 AM In reply to

    Re: Need Help on iis + DataProtect.Protect

    Hi,

    This is indeed a program development issue. You can only configure the ASP.Net application run in admin account by changing the application identity (IIS6.0) or editing the  section “ <processModel />” in  machine.config file(IIS5.1 and previous version).  But running an ASP.net application in admin account is not recommended.

    You may try to use another cryptographic method which do not need to load user profiles, you can get more valuable suggestions at ASP.Net Froum.

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (2 items)
Microsoft Communities