DPAPI on Hosted Application?

Discussion in 'ASP.NET / ASP.NET Core' started by DaGmen, Feb 13, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have an ASP.Net application that uses Forms Authentication and ASP.Net Roles security. Iam using the Microsoft DPAPIclass library to encrypt/decrypt my connection strings in my web.config.
    I would like to know, if I use DiscountASP.Net to host my application will I be able to still use this encryption function? I am unable to use it with my current hosting provider?
    Also does DiscountASP.Net offer Dedicated Web servers to go along with the dedicated SQL servers?

    Thanks,
    DaGmen.
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    I did some research and do not think you can use this API on our server (i doubt that you can use it on any shared service) because it requires the ASPNET user (ASPNET user) to have a profile on the server, ie. you have to login interactively at least once on the server.

    See http://www.obviex.com/samples/dpapi.aspx

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. I have implemented the DPAPI using User_Store method, on my local machine without any problems. I deployed my entire application to the discountasp.net server and now I get errors? It seems that DPAPI is NOT supported/allowed on hosted servers? What other options do I have for encrypting and decrypting my connection strings?


    Thanks.
     
  4. Bruce

    Bruce DiscountASP.NET Staff

  5. Thanks for trying to help, but I cancelled my account. This shared hosting is not suitable for my business.
     
  6. This is exactly the same problem I am having. I am guessing his problem is this:


    Access to the path 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\8j12nb5n.tmp' is denied.
    Which you get when you try to protect the section on web config. I use the very same encryption mechanism for mine.

    At this point I myself am a bit baffled as to what to do. I actually find it hard to believe that it should be so tough to encrypt configuration sections on a hosted environment. I've pretty much tried everything (everything one can do without access to key areas, which is understandable)

    I am still researching this problem but certainly if you know how to effectively encrypt web.config on a shared environment please, let us know because 99.9% of everything you can find on MS or other KB sites miserably fails to mention shared hosting. One would think this is a tried requirement for everyone...

    thanks
    Madvox
     
  7.  
  8. I hear you say this (or read what you say)...and you can't imagine how many times I have asked myself the same question. I don't blame DASP because this happens on any other shared hosting environment. But like we said, there should be a straight forward solution rather than try to circumvent all these barriers. I mean what's the point of providing an encryption API if it requires admin permissions to run?

    The thing is, there are solutions that we could use but they are not good. If you were to write your own encryption provider (which I did already) then you could handle it from within your classes. But if you also have membership and security services implemented for .NET then you've got to get those talking to your provider as well which completely defeats the purpose of having default security providers.

    Well, let me say this... I will put another 24 hours into finding a solution. Perhaps DASP has encountered this problem before and has some advice. It is hard to believe also that none of the other .NET sites here are protecting their config data. Perhaps someone could share their two cents with us. I,like you,do not want to leave my config data open as much as I really like how everything else is working.

    Madvox
     
  9. Bruce

    Bruce DiscountASP.NET Staff

    We have done some research on this topic and I don't think it is possible to get this to work on a shared hosting environment. Personally, I don't understand why MSFT has designed to API to work this way but it seems like there is not option to configure this.

    Although it is not absolutely secure to keep plain text information in web.config, it is relatively secure because

    1)User cannot access your web.config over HTTP (IIS blocks this)

    2)Other users on the same server cannotaccess your web.config overfile system.We configure each website to run in its ownidenitywhich prohibit other users to access other directories programmatically.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  10. Thanks Bruce.


    I am also still researching this topic from a development perspective, but for now, I will keepweb.config open since everything else is working very well.


    Madvox
     
  11. Bruce

    Bruce DiscountASP.NET Staff

    let us know what you find out.. i have a personal interest in knowing how to resolve this.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  12. I'm also experiencing this and possibly had some insight. Looking at this article http://msdn2.microsoft.com/en-us/library/dtkwfdky(VS.80).aspxit appears that the ASP.NET identity, which is likely "NT AUTHORITY\NETWORK SERVICE" needs read access to the default DPAPI or RSA key containers (the defautl one is named NetFrameworkConfigurationKey), which it likely doesn't have. Is it okay for webhost providers to run:
    aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT AUTHORITY\NETWORK SERVICE"

    On all their servers? This would allow the apps to function normally I believe ...

    Thanks
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page