Hello there,
My windows application has a browser component to navigate local sites.
The app is written in C# and VS 2005. It works perfectly under IIS and I tried embedding Cassini directly. This second solution allows me to navigate the site but when I need to encrypt the web.config file ....i get the problems
So before I try embeding UltiDev into my application I need to know if I can encrypt web.config files
using one of the 2 following techniques:
1)
Configuration config = WebConfigurationManager.OpenWebConfiguration("/MyVirtualSite");
ConnectionStringsSection section = config.GetSection("connectionStrings") as ConnectionStringsSection;
if (section.SectionInformation.IsProtected == false)
section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
config.Save();
2) Running a command with aspnet_regiis
string param = "-pe \"connectionStrings\" -app \"/MyVirtualSite\" -prov \"DataProtectionConfigurationProvider\"";
Process myProcess = new Process();
object o = new object();
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.FileName = "aspnet_regiis";
myProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(o.GetType().Assembly.Location);
myProcess.StartInfo.Arguments = param;
myProcess.Start();
myProcess.WaitForExit();
myProcess.Close();
The issue seems to be that both "WebConfigurationManager.OpenWebConfiguration" and "aspnet_regiis" takes the parameter VirtualDirectory from IIS in order to get the PhysicalPath of the web.config. In my case, IIS will be disabled (that's the reason of using embeded solution) so both code fail !!!
QUESTON:
Is there a way using UltiDev that allows me to encrypt the web.config files located in a folder of my knowledge?
Thanks,
Filippo