We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

[5263] Encrypting Web.config sections in ASP.NET 2.0

Last post 10-12-2006 8:52 PM by unRheal. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [5263] Encrypting Web.config sections in ASP.NET 2.0

    This thread is for discussions of Encrypting Web.config sections in ASP.NET 2.0.

    • Post Points: 0
  • 01-27-2006 2:45 AM In reply to

    • n8nt
    • Not Ranked
    • Joined on 01-27-2006
    • New Member
    • Points 10

    Ecryption of the web.config

    I have tried this on 3 of my websites and it works on 2 of them but I cannot figure out why it won't work on the 3rd one.  I did it using the aspnet_regiis command line.  I keep getting an error saying that reads as follows:

    Encrypting Configuration section...
    A configuration file cannot be created for the requested Configuration object.
    Failed!

    I have multiple websites on my webserver. I have one under the wwwroot which I encrypted using an app path in the -app parameter that was simply:

    aspnet_regiis -pe "connectionStrings" -app "/"

    I have another which happens to be subweb. I did it like:

    aspnet_regiis -pe "connectionStrings" -app "/main/subweb"

    This one also worked.

    Then I tried it with one of my other ones which was not a subweb, I'll call it app2

    aspnet_regiis -pe "connectionStrings" -app "/app2"

    Now the way these webs are physically on the disc, the first one is under the inetpub/wwwroot and all of the rest are webs that are under a directory which I've named c:/myWebs.  So the actual physical sites are as follows:

    c:/myWebs/main/subweb

    c:/myWebs/app2

    The documentation that I can find says that the -app refers to the virtual directory so I am wondering if I am putting in the correct parameter for the -app keyword. Actually the name is pretty long - 23 characters, so maybe that could be a problem too.

    Anyway, I was thinking of doing this programatically, but then I wondered how would that actually work? Would I create a special page that only I could access that would have an encrypt and decrypt button? Otherwise, what would prevent a casual hacker from going in and encrypting it? or decrypting it? I think I'm missing part of the equation -- perhaps you can enlighten me...

    Thanks,

    • Post Points: 10
  • 10-12-2006 8:52 PM In reply to

    • unRheal
    • Not Ranked
    • Joined on 10-12-2006
    • New Member
    • Points 5

    Re: Ecryption of the web.config

    I noticed you found your own answer - and if anyone else comes here looking for the answer, they can see your solution at:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=218559&SiteID=1

    (which is basically to go to the properties of the folder, select the Web Sharing tab, and select "Share this folder")

    Thanks! :)

    • Post Points: 5
Page 1 of 1 (3 items)