Skip to content

Instantly share code, notes, and snippets.

@pranaysingireddy
pranaysingireddy / SqlColumnEncryptionAzureKeyVaultProvider.cs
Created May 23, 2020 02:38
Decompiled version of the AzureKeyVaultProvider NuGet package and added support for .NET Core
using Microsoft.Azure.KeyVault;
using Microsoft.Azure.KeyVault.Models;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
declare @TableName sysname = 'TableName'
declare @Result varchar(max) = 'public class ' + @TableName + '
{'
select @Result = @Result + '
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
'
from
(
select
@pranaysingireddy
pranaysingireddy / Login.aspx
Created February 27, 2019 20:24 — forked from andyshora/Login.aspx
Password protect a website on Windows Azure
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Security" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
public void Login_OnClick(object sender, EventArgs args)
{
if (FormsAuthentication.Authenticate(UsernameTextbox.Text, PasswordTextbox.Text))
FormsAuthentication.RedirectFromLoginPage(UsernameTextbox.Text, NotPublicCheckBox.Checked);
@pranaysingireddy
pranaysingireddy / ForgotPassword.cshtml
Created February 27, 2019 20:22 — forked from DavidVeksler/ForgotPassword.cshtml
Umbraco 7: reset password for user and forgot password implementation
@using FEE.Domain
@inherits UmbracoTemplatePage
@{
Layout = "FEEMaster.cshtml";
var featuredImage = CoverImageProvider.GetCoverImageOrDefault(CurrentPage.featuredImage);
}
@section bodyClass {subpage}
@*TODO maybe implement:https://github.com/warrenbuckley/CWS-Umbraco-Standard-Membership/blob/master/CWSUmbracoStandardMembership/Views/AuthSurface/ResetPassword.cshtml
@pranaysingireddy
pranaysingireddy / WebFormsBootstrapValidation.aspx
Created February 27, 2019 20:21 — forked from meziantou/WebFormsBootstrapValidation.aspx
ASP.NET WebForms Validators & Bootstrap
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ASP.NET WebForms Validators & Bootstrap</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css" />
@pranaysingireddy
pranaysingireddy / example.cs
Created February 27, 2019 20:17 — forked from brandonmwest/example.cs
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@pranaysingireddy
pranaysingireddy / 1.cs
Created February 27, 2019 20:16 — forked from cuppster/1.cs
Promises for C# using Generics
/*
modified from original source: https://bitbucket.org/mattkotsenas/c-promises/overview
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Promises
@pranaysingireddy
pranaysingireddy / FileDownloader.cs
Created February 27, 2019 20:15 — forked from yasirkula/FileDownloader.cs
C# Download Public File From Google Drive™ (works for large files as well)
using System;
using System.IO;
using System.Net;
public static class FileDownloader
{
private const string GOOGLE_DRIVE_DOMAIN = "drive.google.com";
private const string GOOGLE_DRIVE_DOMAIN2 = "https://drive.google.com";
// Normal example: FileDownloader.DownloadFileFromURLToPath( "http://example.com/file/download/link", @"C:\file.txt" );
@pranaysingireddy
pranaysingireddy / EFExtensions.cs
Created February 27, 2019 20:15 — forked from ondravondra/EFExtensions.cs
C# extension for executing upsert (MERGE SQL command) in EF with MSSQL
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
namespace EFExtensions
@pranaysingireddy
pranaysingireddy / Ninject.Http.cs
Created February 27, 2019 20:15 — forked from odytrice/Ninject.Http.cs
A small Library to configure Ninject (A Dependency Injection Library) with a WebAPI Application.
using Ninject.Modules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Http;
using System.Web.Http.Dependencies;
// A small Library to configure Ninject (A Dependency Injection Library) with a WebAPI Application.