This Gist file is dedicated for the Ask me anything session. The next session will be on the June 7th - 12:00 AM Tunis localtime.
Just ask your question here 😁
See you soon ! 🙋
public static void RunAsDesktopUser(string fileName) | |
{ | |
if (string.IsNullOrWhiteSpace(fileName)) | |
throw new ArgumentException("Value cannot be null or whitespace.", nameof(fileName)); | |
// To start process as shell user you will need to carry out these steps: | |
// 1. Enable the SeIncreaseQuotaPrivilege in your current token | |
// 2. Get an HWND representing the desktop shell (GetShellWindow) | |
// 3. Get the Process ID(PID) of the process associated with that window(GetWindowThreadProcessId) | |
// 4. Open that process(OpenProcess) |
This Gist file is dedicated for the Ask me anything session. The next session will be on the June 7th - 12:00 AM Tunis localtime.
Just ask your question here 😁
See you soon ! 🙋
using Owin; | |
namespace WindowsAuthAppToAADDemo | |
{ | |
public partial class Startup | |
{ | |
public void Configuration(IAppBuilder app) | |
{ | |
ConfigureAuth(app); | |
} |
using System; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using Serilog; | |
using Serilog.Configuration; | |
using Serilog.Core; | |
using Serilog.Events; | |
namespace ConsoleApp24 |
using System; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Web.Http; | |
using System.Web.Http.Controllers; | |
using System.Web.Http.Metadata; |
# Create a new self signed HTTPS Certificate for IIS Express | |
# Crafted with all organic, GMO, gluten free ingreditations | |
# with an artisinal SAN to make Chrome 58 onwards happy. | |
# | |
# See https://bugs.chromium.org/p/chromium/issues/detail?id=308330 | |
# | |
# Run this at an administrative PowerShell prompt. | |
# | |
# You will be prompted to trust a new certificate via a windows dialog. | |
# Click yes otherwise Visual Studio will not be able to determine your |
# Copyright 2019, Alexander Hass | |
# https://www.hass.de/content/setup-microsoft-windows-or-iis-ssl-perfect-forward-secrecy-and-tls-12 | |
# | |
# After running this script the computer only supports: | |
# - TLS 1.2 | |
# | |
# Version 3.0.1, see CHANGELOG.txt for changes. | |
Write-Host 'Configuring IIS with SSL/TLS Deployment Best Practices...' | |
Write-Host '--------------------------------------------------------------------------------' |
# Batch convert all .ppt/.pptx files encountered in folder and all its subfolders | |
# The produced PDF files are stored in the invocation folder | |
# | |
# Adapted from http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf | |
# Thanks to MFT, takabanana, ComFreek | |
# | |
# If PowerShell exits with an error, check if unsigned scripts are allowed in your system. | |
# You can allow them by calling PowerShell as an Administrator and typing | |
# ``` | |
# Set-ExecutionPolicy Unrestricted |
// Example 1: Signing a byte[] using PKCS#1 v1.5 padding and a SHA-256 hash | |
// 4.5: | |
public static byte[] SignDataPkcs1Sha256(X509Certificate2 cert, byte[] data) | |
{ | |
// X509Certificate2.PrivateKey returns the same object across multiple calls, | |
// so it shouldn't be Disposed independent of the X509Certificate2 object. | |
// | |
// The RSA base class doesn't expose any signature-based methods. | |
// The PrivateKey property returns AsymmetricAlgorithm, so really this call should be |
$/
artifacts/
build/
docs/
lib/
packages/
samples/
src/
tests/