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
1. Go to appsettings.json file and add the secret key for the JWT encryption. | |
"AppSettings": { | |
"Secret": "HHPM0JEOMLGYXYU5YS32" | |
}, | |
2. Create a class as “AppSettings.cs” to access the AppSetting values trough a class. | |
namespace NetCoreWebAPI.Helpers |
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 readonly IConfiguration _configuration; | |
public Tools(IConfiguration configuration) | |
{ | |
_configuration = configuration; | |
} | |
public string GetConfigKey(string categoryName, string keyName) | |
{ | |
string keyValue = null; |
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
in startup.cs | |
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>(); | |
services.AddScoped<IUrlHelper>(x => { | |
var actionContext = x.GetRequiredService<IActionContextAccessor>().ActionContext; | |
var factory = x.GetRequiredService<IUrlHelperFactory>(); | |
return factory.GetUrlHelper(actionContext); | |
}); | |
then could inject IUrlHelper |
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
1. add html below in <app-root></app-root> or in index.html | |
<app-root> | |
<div id="pre-bootstrap"> | |
<div class="messaging"> | |
<h1> | |
Website is Loading | |
</h1> | |
<div class="app-loader"> | |
<div class="app-loader-inner"> |
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
string decryptPassword = MD5DESEncryption.Decrypt(model.Password, true); | |
private static string securityKey = "Dicker183654729Data"; | |
public static string Encrypt(string toEncrypt, bool useHashing) | |
{ | |
string retVal = string.Empty; | |
try | |
{ | |
byte[] keyArray; |
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
StringBuilder stringBuilder = new StringBuilder(); | |
stringBuilder.Append("<div style='padding: 0; margin: 0; height: 100%; background:#fbfaf7;'>"); | |
stringBuilder.Append("<table width='100%' height='100%' align='center' cellspacing='0' cellpadding='0' bgcolor='#fbfaf7'>"); | |
stringBuilder.Append("<tbody>"); | |
stringBuilder.Append("<tr><td style='font:12px/1.5 Arial,Helvetica,sans-serif;color:#454545'> </td></tr>"); | |
stringBuilder.Append("<tr>"); | |
stringBuilder.Append("<td style='color:#343731;'><table width='600px' bgcolor='#ffffff' cellspacing='0' cellpadding='0' align='center' border='0' style='border:1px solid #232323;text-align:center'><tbody><tr><td style='padding:10px;color:#343731'>"); | |
stringBuilder.Append("<img src='https://via.placeholder.com/150' width='80px' style='margin:0 auto;display:block'>"); | |
stringBuilder.Append("<h1 style='font-weight:400;text-transform:uppercase'>Trojan Trading Company PTY LTD</h1><h4 style='font-weight:400;text-transform:uppercase'>Australia</h4>"); | |
stringBuilder.Append("</td |
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
1. in startup.cs | |
services.AddSingleton<IFileProvider>( | |
new PhysicalFileProvider( | |
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"))); | |
2. in controller | |
#region Upload Users | |
[HttpPost("UploadUsers"), DisableRequestSizeLimit] |
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
1. LoadingScreenComponent | |
import { Subscription } from 'rxjs'; | |
import { Component, OnInit, OnDestroy, Output, EventEmitter, Input } from '@angular/core'; | |
import { LoadingScreenService } from '../../services/loading-screen.service'; | |
import { debounceTime } from 'rxjs/operators'; | |
@Component({ | |
selector: 'loading-screen', |
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
in component | |
//unsubscribe | |
ngUnsubscribe: Subject<void> = new Subject<void>(); | |
this.adminService.GetUserByAccount(_.toNumber(this.shareService.readCookie("userId"))).takeUntil(this.ngUnsubscribe).subscribe() | |
ngOnDestroy() { | |
this.ngUnsubscribe.next(); | |
this.ngUnsubscribe.complete(); |