This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When you want to publish your app and using the Development configuration. | |
By default this loads Production. | |
Create an app service | |
Configure | |
- AppSettings | |
- Add | |
- Name = ASPNETCORE_ENVIRONMENT | |
- Value = Development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When you use NodeServices for your project and need to install package make sure you add the following to your app service configuration. | |
Create an app service | |
Configure | |
- AppSettings | |
- Add | |
- Name = WEBSITE_NODE_DEFAULT_VERSION | |
- Value = 10.0.0 | |
- Save | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
[Route("/api/download/zip/{Code}")] | |
public async Task<IActionResult> Zip(string Code) | |
{ | |
byte[] bytes = null; | |
using (MemoryStream zipStream = new MemoryStream()) | |
{ | |
using (var zip = new ZipArchive(zipStream, ZipArchiveMode.Create, true)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IAuthorizationService _AuthorizationService; | |
public HomeController(IAuthorizationService AuthorizationService) | |
{ | |
this._AuthorizationService = AuthorizationService; | |
} | |
[Authorize(Policy = "SecurityGroup")] | |
public async Task<IActionResult> About() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AzureAd": { | |
"Instance": "https://login.microsoftonline.com/", | |
"Domain": "Directory.onmicrosoft.com", | |
"TenantId": "Dictory ID", | |
"ClientId": "Application ID", | |
"CallbackPath": "/signin-oidc" | |
}, | |
// | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://docs.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads | |
[HttpPost] | |
public void Post(int ItemId) | |
{ | |
var files = Request.Form.Files; | |
if (files.Count > 0) | |
{ | |
using (var client = new AmazonS3Client(_aws.AccessKey, _aws.SecretKey, Amazon.RegionEndpoint.EUWest2)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// open ssh connection to your remote | |
ssh user@ip | |
// ssh tunnel for vnc | |
// screen share using 'localhost:15900' => 'remote:5900' | |
ssh -N -p 22 user@ip -L 127.0.0.1:15900:127.0.0.1:5900 -v | |
// ssh copy mac | |
// remote location eg. '~/desktop' | |
scp <local_file_location> user@ip:<remote_location> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load bash profile with permission | |
// write your lines and crtl+o to write - ctrl+x to exit | |
sudo nano ~/.bash_profile | |
// if bash profile does not exist | |
touch ~/.bash_profile | |
// refresh bash profile after adding alias, etc. | |
source ~/.bash_profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ErrorHandlingMiddleware | |
{ | |
private readonly RequestDelegate _next; | |
private readonly EmailSettings _settings; | |
public ErrorHandlingMiddleware(RequestDelegate next, IOptions<EmailSettings> settings) | |
{ | |
_next = next; | |
_settings = settings.Value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://forums.asp.net/t/2071573.aspx?Call+SQL+Server+Function+with+UDT+as+input+parameter | |
public async Task<int> MainCategorySort(int BrandId, IEnumerable<MainCategoryViewModel> vm, string ModifiedBy) | |
{ | |
var udt = new DataTable(); | |
udt.Columns.Add("MainCategoryId", typeof(int)); | |
udt.Columns.Add("CMSOrder", typeof(int)); | |
foreach(var item in vm) |