Skip to content

Instantly share code, notes, and snippets.

View web-asp-app-in-ase.template.json
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"webAppName": {
"type": "string"
},
"appServicePlanName": {
"type": "string"
},
View TransformOctopusConfig.ps1
function transform($xml, $xdt, $output)
{
Add-Type -LiteralPath "Microsoft.Web.XmlTransform.dll"
$xmldoc = New-Object Microsoft.Web.XmlTransform.XmlTransformableDocument;
$xmldoc.PreserveWhitespace = $true
$xmldoc.Load($xml);
$transform = New-Object Microsoft.Web.XmlTransform.XmlTransformation($xdt);
if ($transform.Apply($xmldoc) -eq $false)
View AppFabricTracingWorkaround.cs
public static class PowershellExtensions
{
public static Collection<PSObject> InvokeCommandAndRestoreDefaultTraceListener(this Pipeline pipeline)
{
bool hasDefaultTraceListener = PowershellExtensions.IsDefaultTraceListenerPresent();
Collection<PSObject> results = pipeline.Invoke();
if(hasDefaultTraceListener && !PowershellExtensions.IsDefaultTraceListenerPresent())
{
View AppFabricHatesTracing.cs
InitialSessionState state = InitialSessionState.CreateDefault();
state.ImportPSModule(new string[] { "DistributedCacheAdministration", "DistributedCacheConfiguration" });
state.ThrowOnRunspaceOpenError = true;
using(Runspace rs = RunspaceFactory.CreateRunspace(state))
{
rs.Open();
using(Pipeline pipeline = rs.CreatePipeline())
{
View HandleAuthenticationDialogForIE_v2.cs
// Add references to the following assemblies:
// System.Windows.Forms
// UIAutomationClient
// UIAutomationTypes
using System.Windows.Automation;
using System.Windows.Forms;
// Portions of code adapted from http://www.mathpirate.net/log/2009/09/27/swa-straight-outta-redmond/
public static void HandleAuthenticationDialogForIE(string userName, string password)
@nshenoy
nshenoy / HandleAuthenticationDialogForIE.cs
Last active Dec 13, 2015
UIAutomation code to handle the Windows Security dialog when testing in Internet Explorer
View HandleAuthenticationDialogForIE.cs
// Add references to the following assemblies:
// System.Windows.Forms
// UIAutomationClient
// UIAutomationTypes
using System.Windows.Automation;
using System.Windows.Forms;
// Portions of code adapted from http://www.mathpirate.net/log/2009/09/27/swa-straight-outta-redmond/
public static void HandleAuthenticationDialogForIE(string userName, string password)