├── UrlPrettyPrintWeb ├── Views │ ├── _ViewStart.cshtml │ ├── _ViewImports.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ └── Home │ │ ├── Pretty.cshtml │ │ └── Index.cshtml ├── appsettings.Development.json ├── appsettings.json ├── UrlPrettyPrintWeb.csproj ├── Program.cs ├── Properties │ └── launchSettings.json └── Controllers │ └── HomeController.cs ├── README.md ├── UrlPrettyPrint ├── UrlPrettyPrint.csproj └── Pretty.cs ├── LICENSE ├── UrlPrettyPrint.sln ├── .github └── workflows │ └── master_urlprettyprint.yml ├── .gitattributes └── .gitignore /UrlPrettyPrintWeb/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Url Pretty Print 2 | ============== 3 | 4 | A basic url pretty printer for breaking up a one line url into parameters. 5 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using UrlPrettyPrintWeb 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /UrlPrettyPrint/UrlPrettyPrint.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | Error 10 | 11 | 12 |
13 |

Error.

14 |

An error occurred while processing your request.

15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/UrlPrettyPrintWeb.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/Program.cs: -------------------------------------------------------------------------------- 1 | var builder = WebApplication.CreateBuilder(args); 2 | 3 | // Add services to the container. 4 | builder.Services.AddControllersWithViews(); 5 | 6 | var app = builder.Build(); 7 | 8 | // Configure the HTTP request pipeline. 9 | if (!app.Environment.IsDevelopment()) 10 | { 11 | app.UseExceptionHandler("/Home/Error"); 12 | } 13 | app.UseStaticFiles(); 14 | 15 | app.UseRouting(); 16 | 17 | app.UseAuthorization(); 18 | 19 | app.MapControllerRoute( 20 | name: "default", 21 | pattern: "{controller=Home}/{action=Index}/{id?}"); 22 | 23 | app.Run(); 24 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:14346", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "UrlPrettyPrintWeb": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "http://localhost:5062", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using System.Diagnostics; 3 | using System.Text; 4 | using System.Web; 5 | 6 | namespace UrlPrettyPrintWeb.Controllers 7 | { 8 | public class HomeController : Controller 9 | { 10 | private readonly ILogger _logger; 11 | 12 | public HomeController(ILogger logger) 13 | { 14 | _logger = logger; 15 | } 16 | public ActionResult Index() 17 | { 18 | return View(); 19 | } 20 | 21 | [HttpPost] 22 | public ActionResult Index(string txturl) 23 | { 24 | ViewBag.q = txturl; 25 | ViewBag.pretty = UrlPrettyPrint.Pretty.Print(txturl); 26 | return View("Pretty"); 27 | } 28 | 29 | public ActionResult Error() 30 | { 31 | return View(); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/Views/Home/Pretty.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Url Pretty Printed 12 | 13 | 14 | 19 | 20 | 21 | 22 |

23 | Busy: @Html.Raw(ViewBag.q) 24 |

25 |
26 |

27 | Pretty: 28 |

29 |
30 | @Html.Raw(ViewBag.pretty)
31 |         
32 |

33 | New pretty 34 |

35 | 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Shearn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @RenderSection("meta", required: false) 8 | 9 | @ViewBag.Title 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | @RenderSection("header", required: false) 21 | 22 | 23 | 24 | @RenderSection("nav", required: false) 25 | 26 |
27 | @RenderBody() 28 |
29 | 30 | @RenderSection("scripts", required: false) 31 | 32 | -------------------------------------------------------------------------------- /UrlPrettyPrint/Pretty.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using System.Web; 3 | 4 | namespace UrlPrettyPrint 5 | { 6 | public static class Pretty 7 | { 8 | public static string Print(string urlValue) 9 | { 10 | 11 | if (string.IsNullOrWhiteSpace(urlValue)) 12 | { 13 | return string.Empty; 14 | } 15 | 16 | var sb = new StringBuilder(); 17 | 18 | // split up 19 | var qs = urlValue.Split('?'); 20 | sb.AppendLine(qs[0]); 21 | sb.AppendLine(); 22 | 23 | // get params 24 | var parms = qs.Count() < 2 ? qs[0] : qs[1]; 25 | var parse = HttpUtility.ParseQueryString(parms); 26 | var keys = (from string k in parse.Keys where !string.IsNullOrEmpty(k) select k).ToList(); 27 | 28 | if (!keys.Any()) 29 | { 30 | return string.Empty; 31 | } 32 | 33 | // determine spacing 34 | var longestLength = keys.OrderByDescending(k => k.Length).First().Length; 35 | 36 | foreach (string k in keys) 37 | { 38 | sb.Append(k); 39 | sb.Append(new String(' ', longestLength - k.Length)); 40 | sb.Append(" = "); 41 | sb.AppendLine(parse[k]); 42 | } 43 | 44 | return sb.ToString(); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /UrlPrettyPrint.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32210.238 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UrlPrettyPrintWeb", "UrlPrettyPrintWeb\UrlPrettyPrintWeb.csproj", "{5F4ACFBA-6654-4E17-A0C9-0415F92CE7F6}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrlPrettyPrint", "UrlPrettyPrint\UrlPrettyPrint.csproj", "{5C98412F-EA65-4DF8-9866-35102092B9D3}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {5F4ACFBA-6654-4E17-A0C9-0415F92CE7F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {5F4ACFBA-6654-4E17-A0C9-0415F92CE7F6}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {5F4ACFBA-6654-4E17-A0C9-0415F92CE7F6}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {5F4ACFBA-6654-4E17-A0C9-0415F92CE7F6}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {5C98412F-EA65-4DF8-9866-35102092B9D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {5C98412F-EA65-4DF8-9866-35102092B9D3}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {5C98412F-EA65-4DF8-9866-35102092B9D3}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {5C98412F-EA65-4DF8-9866-35102092B9D3}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {B38CA405-C5B1-4341-A22B-AF3E164418F3} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /.github/workflows/master_urlprettyprint.yml: -------------------------------------------------------------------------------- 1 | # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy 2 | # More GitHub Actions for Azure: https://github.com/Azure/actions 3 | 4 | name: Build and deploy ASP.Net Core app to Azure Web App - urlprettyprint 5 | 6 | on: 7 | push: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Set up .NET Core 20 | uses: actions/setup-dotnet@v1 21 | with: 22 | dotnet-version: '6.0.x' 23 | include-prerelease: true 24 | 25 | - name: Build with dotnet 26 | run: dotnet build --configuration Release 27 | 28 | - name: dotnet publish 29 | run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp 30 | 31 | - name: Upload artifact for deployment job 32 | uses: actions/upload-artifact@v2 33 | with: 34 | name: .net-app 35 | path: ${{env.DOTNET_ROOT}}/myapp 36 | 37 | deploy: 38 | runs-on: ubuntu-latest 39 | needs: build 40 | environment: 41 | name: 'Production' 42 | url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} 43 | 44 | steps: 45 | - name: Download artifact from build job 46 | uses: actions/download-artifact@v2 47 | with: 48 | name: .net-app 49 | 50 | - name: Deploy to Azure Web App 51 | id: deploy-to-webapp 52 | uses: azure/webapps-deploy@v2 53 | with: 54 | app-name: 'urlprettyprint' 55 | slot-name: 'Production' 56 | publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_D2E850FD07F1499AA7B236C499F63D15 }} 57 | package: . 58 | -------------------------------------------------------------------------------- /UrlPrettyPrintWeb/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Url Pretty Print"; 3 | } 4 | 5 | @section meta { 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | } 30 | 31 |
32 |
33 |

Url Pretty Print

34 |
35 | 36 |

37 | A basic pretty printer for breaking up a one line url into parameters. 38 |

39 | 40 |

41 | Paste the Url in the text area below, click the "Pretty Print Url" button, and see pretty printed Url. 42 |

43 | 44 | @{ Html.BeginForm("Index", "Home", FormMethod.Post); } 45 |
46 | 47 |
48 | 49 | 50 | 51 |

52 | 53 |

54 | @{ Html.EndForm(); } 55 |
56 |
57 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | --------------------------------------------------------------------------------