What is the proper method for encrypting ASP.NET connetionStrings?

后端 未结 3 939
忘了有多久
忘了有多久 2021-02-06 17:38

I\'ve been looking through several examples of encrypting connectionStrings (Web.config) in an ASP.NET MVC application (.NET 4.0) and it seems that there are two general ways to

3条回答
  •  旧巷少年郎
    2021-02-06 17:58

    The easiest way with the shared hoster is probably going to be to write your own encrypt/decrypt utility and store the connection string either in app settings, custom XML file, or text file, so that you have full control over the encryption/decryption process...

    Per your update, you can get the current request via:

    new HttpRequestWrapper(System.Web.HttpContext.Current.Request);
    

    HTH.

提交回复
热议问题