For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
| # | |
| # Powershell script for adding/removing/showing entries to the hosts file. | |
| # | |
| # Known limitations: | |
| # - does not handle entries with comments afterwards ("<ip> <host> # comment") | |
| # | |
| $file = "C:\Windows\System32\drivers\etc\hosts" | |
| function add-host([string]$filename, [string]$ip, [string]$hostname) { |
| The regex patterns in this gist are intended to match any URLs, | |
| including "mailto:foo@example.com", "x-whatever://foo", etc. For a | |
| pattern that attempts only to match web URLs (http, https), see: | |
| https://gist.github.com/gruber/8891611 | |
| # Single-line version of pattern: | |
| (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) |
| @echo off | |
| REM If PowerShell 2 is not installed, this script will automatically download and install it. | |
| REM Only works on XP SP3 with .NET 3.5. Only for dev boxes, not designed for servers. | |
| REM Based on http://blog.codeassassin.com/2009/12/10/no-web-browser-need-powershell/ | |
| ver | find "XP" > nul | |
| if %ERRORLEVEL% neq 0 goto not_xp | |
| ver | find "5.1.2600" > nul |
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Reflection; | |
| using NUnit.Framework; | |
| namespace MyProject | |
| { | |
| [TestFixture] |
| <UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | |
| <ParameterGroup> | |
| <OutputFilename ParameterType="System.String" Required="true" /> | |
| </ParameterGroup> | |
| <Task> | |
| <Reference Include="System.Core" /> | |
| <Reference Include="System.Xml" /> | |
| <Reference Include="WindowsBase" /> | |
| <Using Namespace="System" /> | |
| <Using Namespace="System.IO" /> |
| // Original idea: http://stackoverflow.com/questions/9565889/get-the-ip-address-of-the-remote-host | |
| using System.Net.Http; | |
| using System.ServiceModel.Channels; | |
| using System.Web; | |
| namespace CrowSoftware.Api | |
| { | |
| public static class HttpRequestMessageHelper | |
| { |
| using System.Linq; | |
| using Isite.Sitecore.UI.WebControls; | |
| using Isite.Extensions; | |
| using System.Web.UI; | |
| using System.Threading.Tasks; | |
| using Sitecore.Data.Items; | |
| using System.Collections.Generic; | |
| using System.Threading; | |
| using Sitecore.Caching; | |
| using System.Diagnostics; |
| public class ImageCompressionProcessor | |
| { | |
| public void Process(GetMediaStreamPipelineArgs args) | |
| { | |
| MediaStream outputStream = args.OutputStream; | |
| if (outputStream == null) | |
| return; | |
| var bitmap = new Bitmap(Image.FromStream(outputStream.Stream)); |
FORMAT: 1A
Answer to "How to format a POST request on apiary.io". Make sure to refer to "application/x-www-form-urlencoded or multipart/form-data".
Do not forget to escape [ with %5B and ] with %5D in data[User][username]=qq&data[User][password]=qq&data[User][remember]=0.