Skip to content

Instantly share code, notes, and snippets.

View prakash-patel's full-sized avatar

Prakash Patel prakash-patel

View GitHub Profile
@prakash-patel
prakash-patel / IIS_Powershell.ps1
Created March 8, 2019 19:29
Powershell IIS Script
#PART-1 Export IIS Application into Excel
import-module webadministration
$servername = $env:computername
get-website | select name,id,state,physicalpath,
@{n="Bindings"; e= { ($_.bindings | select -expa collection) -join ';' }} ,
@{n="LogFile";e={ $_.logfile | select -expa directory}},
@{n="attributes"; e={($_.attributes | % { $_.name + "=" + $_.value }) -join ';' }} |
Export-Csv -NoTypeInformation -Path C:\iis-sites.csv
@prakash-patel
prakash-patel / swaggerSpec.json
Created May 4, 2016 20:45
Swagger Spec Created Using VS 2013 Target Framework 4.5 Asp.NET MVC Project
{"swagger":"2.0","info":{"version":"v2","title":"TestingSwagger"},"host":"localhost:59988","schemes":["http"],"paths":{"/api/Account/UserInfo":{"get":{"tags":["Account"],"operationId":"Account_GetUserInfo","consumes":[],"produces":["application/json","text/json","application/xml","text/xml"],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/UserInfoViewModel"}}},"deprecated":false}},"/api/Account/Logout":{"post":{"tags":["Account"],"operationId":"Account_Logout","consumes":[],"produces":["application/json","text/json","application/xml","text/xml"],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Object"}}},"deprecated":false}},"/api/Account/ManageInfo":{"get":{"tags":["Account"],"operationId":"Account_GetManageInfo","consumes":[],"produces":["application/json","text/json","application/xml","text/xml"],"parameters":[{"name":"returnUrl","in":"query","required":true,"type":"string"},{"name":"generateState","in":"query","required":false,"type":"boolean"}],"responses":{"
public async Task<string> HttpCall(string template, X509Certificate2 certificate, string url)
{
try
{
#region httpClient
var httpContent = new StringContent(template, Encoding.UTF8, "application/soap+xml");
var handler = new WebRequestHandler();
handler.AuthenticationLevel = AuthenticationLevel.MutualAuthRequested;
@prakash-patel
prakash-patel / gist:b11b8547c99afd8f87df
Created November 25, 2014 15:15
Validate the date time
/// <summary>
/// Validates the date time. yyyymmddhhmmssfffk
/// </summary>
/// <param name="dateString">The date string.</param>
public bool ValidateDateTime(string dateString)
{
const string malformedTimeZone =
@"^\d{4}(?:(?:0[0-9]|1[0-2])(?:(?:[0-2][0-9]|3[0-1]))?(?:(?:[0-1][0-9]|2[0-4]))?(?:(?:[0-5][0-9]))?(?:(?:[0-5][0-9])(?:\.\d+)?)?)?(?:[+-](0[0-9]|1[0-2]):[0-5][0-9])?$";
return Regex.IsMatch(dateString, malformedTimeZone);