Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

corespider

🎯
Focusing
View GitHub Profile
@corespider
corespider / Packages.cs
Created Oct 2, 2020
JWT-Authentication ackages
View Packages.cs
Install-Package Microsoft.AspNetCore.Authentication.JwtBearer
// It enables JWT authentication in ASP.NET Core
Install-Package Microsoft.AspNetCore.Identity.EntityFrameworkCore
// This enable Identity in EF core
Install-Package Microsoft.EntityFrameworkCore
// This enable EF core
Install-Package Microsoft.EntityFrameworkCore.Design
// This package helps EFCore Design
Install-Package Microsoft.EntityFrameworkCore.SqlServer
// It provides support for creating and validating a JWT token.
@corespider
corespider / _Layout.cshtml
Created Sep 21, 2020
Layout view of CoreSpider
View _Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
</head>
<body>
<div>
@RenderBody()
@corespider
corespider / Startup.cs
Created Sep 19, 2020
Razor File compilation-corespider
View Startup.cs
public IWebHostEnvironment WebHostEnvironment { get; }
public Startup(IWebHostEnvironment webHostEnvironment)
{
WebHostEnvironment = webHostEnvironment;
}
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
#if DEBUG
if (WebHostEnvironment.IsDevelopment())
View ViewData.cshtml
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Customer Management</title>
<script src="~/lib/jquery/jquery.js"></script>
<link href="~/lib/twitter-bootstrap/css/bootstrap.css" rel="stylesheet" />
</head>
<body>
@{
View HomeController.cs
public class HomeController : Controller
{
public ViewResult Index()
{
ViewData["Title"] = "Customer Details";
Customer _customer = new Customer() {
custid = 1,
name = "John Smith",
address = "USA",
@corespider
corespider / winform.cs
Last active Sep 8, 2020
How to Check if file exists on Server in Windows Form C#
View winform.cs
private void btnCheck_Click(object sender, EventArgs e)
{
bool result = CheckFileExists(txtURL.Text);
if (result)
{
MessageBox.Show("The file exists on the server.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("The file couldn't be found on the server.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
View HomeController.cs
public class HomeController : Controller
{
public ViewResult Details()
{
return View();
}
}
@corespider
corespider / log.txt
Created Aug 24, 2020
Worker service in .NET Core
View log.txt
2020-08-24 12:58:22.306 +05:30 [INF] CoreSpider is running and the Status code "OK"
2020-08-24 12:58:22.307 +05:30 [INF] Worker running at: "2020-08-24T12:58:22.3073606+05:30"
2020-08-24 12:58:35.012 +05:30 [INF] CoreSpider is running and the Status code "OK"
2020-08-24 12:58:35.013 +05:30 [INF] Worker running at: "2020-08-24T12:58:35.0134560+05:30"
2020-08-24 12:58:47.011 +05:30 [INF] CoreSpider is running and the Status code "OK"
2020-08-24 12:58:47.012 +05:30 [INF] Worker running at: "2020-08-24T12:58:47.0123668+05:30"
2020-08-24 12:58:58.158 +05:30 [INF] CoreSpider is running and the Status code "OK"
2020-08-24 12:58:58.159 +05:30 [INF] Worker running at: "2020-08-24T12:58:58.1588869+05:30"
2020-08-24 12:59:10.445 +05:30 [INF] CoreSpider is running and the Status code "OK"
2020-08-24 12:59:10.446 +05:30 [INF] Worker running at: "2020-08-24T12:59:10.4465566+05:30"
@corespider
corespider / cmd.bat
Last active Aug 24, 2020
Worker Service in .NET Core
View cmd.bat
:: Create a Windows Service
sc create WorkerService DisplayName="WorkerServiceDotNetCore" binPath="C:\full\path\to\WorkerServiceDotNetCore.exe"
:: Start a Windows Service
sc start WorkerService
:: Stop a Windows Service
sc stop WorkerService
:: Delete a Windows Service
@corespider
corespider / Worker.cs
Last active Aug 23, 2020
Worker Service in .NET Core- Worker Service
View Worker.cs
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
private HttpClient client;
public Worker(ILogger<Worker> logger)
{
_logger = logger;
}
public override Task StartAsync(CancellationToken cancellationToken)
{
You can’t perform that action at this time.