How to OpenWebConfiguration with physical path?

You will have to map the physicalPath to a virtualPath. Here is how you would do that. using System.Web.Configuration; //Reference the System.Web DLL (project needs to be using .Net 4.0 full, not client framework) public static Configuration OpenConfigFile(string configPath) { var configFile = new FileInfo(configPath); var vdm = new VirtualDirectoryMapping(configFile.DirectoryName, true, configFile.Name); var wcfm = … Read more

Make Web.config transformations work locally

if you want to transform a config file without using the Web Publishing Pipeline then you just use the TransformXml task manually. I’ve written a detailed blog post on this at http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx, but here are the high lights: <Project ToolsVersion=”4.0″ DefaultTargets=”Demo” xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″> <UsingTask TaskName=”TransformXml” AssemblyFile=”$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll”/> <Target Name=”Demo”> <TransformXml Source=”app.config” Transform=”Transform.xml” Destination=”app.prod.config”/> </Target> </Project> Here I … Read more

What does existingResponse=”PassThrough” mean in IIS?

There are three possible values, from the schema: <attribute name=”existingResponse” type=”enum” defaultValue=”Auto”> <enum name=”Auto” value=”0″ /> <enum name=”Replace” value=”1″ /> <enum name=”PassThrough” value=”2″ /> </attribute> Roughly, here is how I understand this: PassThrough – leaves the existing response alone, as long as there is one. It is possible that your application logic doesn’t return anything. … Read more

How to prevent an ASP.NET application restarting when the web.config is modified?

Actually, the first two answers are incorrect. It is possible, and quite easy, to prevent this recycling from happening, and this feature has been available since at least IIS6. Method 1 (system wide) Change the DWORD registry setting for HKLM\SOFTWARE\Wow6432Node\Microsoft\ASP.NET\FCNMode to the value 1, which will disable all file change notifications. Don’t be confused by … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)