let today = new Beginning();

Web Development Topics about web development


Creating a proxy to another URL with ASP.NET Core

This post talks about writing a simple HTTP proxy logic in C# or ASP.NET Core. And allowing your project to proxy the request to any other URL. It is not about deploying a proxy server for your ASP.NET Core project. Before starting, you need to be clear about the target you are going to proxy for. It shall be an URL. Add the following code anywhere of your project. public static …

ASP.NET Core Reverse Proxy Web Proxy

微信的架构是如何实现分布式消息分发?

我们每天的生活都离不开微信。微信基本上已经成了在中国生活的一部分。 但是,微信有些方面的功能总是看起来令人觉得有些奇怪。例如: 微信几乎是第一款需要手机扫码才能登录PC端的 微信群和微信聊天记录在切换设备后会完全无法同步 你无法得知自己是否被一个微信好友拉黑了 你不能同时在多个移动设备上同时登录微信 从产品的角度来看,这些设定看起来彷佛是在给用户制造障碍,也成了大家普遍对微信的槽点。那么,微信的团队为什么要这么设计,而为什么又不改良它的体验呢?我想或许问题并不只是产品和需求分析这么简单,而是还需要进一步探寻架构上的本质。 在我生活在澳大利亚期间,我发现一件很有趣的事情:在澳大利亚,我使用微信给同样在澳大利亚的好友发送微信消息,他也可以几乎瞬间收到。假想微信在国内建立单点的服务器,那么这种性能一定不足以支撑澳大利亚内的通信。数据从澳洲抵达中国再从中国推送到澳洲至少需要5 …

Web WeChat Distributed Messging IM

EF second layer cache to enhance your SQL database performance based on Redis

Entity-Framework Core is a lightweight, extensible, open-source, and cross-platform version of the popular Entity Framework data access technology. It really helps the developer to build applications which access database easily. But in most cases, we may cache some results which do not change frequently, to reduce access to our database. For example, the home page of a blog may not change …

ASP.NET Core C# SQL Server SQL Entity Framework Core Azure Redis Caching


Bootstrap dark theme minimum style

Now Apple is forcing all apps in its app store to support dark mode. Also, most native Android apps already support the dark theme. Viewing a screen which white background when you enabled dark mode on your device will greatly harm the viewer's eyes. Like lots of websites are made by bootstrap. So how can we get a solution with minimum changes and allows the website to support automatically …

Web CSS Bootstrap Media Query Style Dark theme

Microsoft account integrated sign in via C#

This code example indicates how to build an app that supports Microsoft account OAuth authentication. Before coding, we gonna create an app in your Azure portal first. https://portal.azure.com The name is your app's display name. Select your app can access accounts in any organization and personal Microsoft account. As for the redirect URI, it must be your server redirect back address. For …

ASP.NET Core Azure Microsoft OAuth Login Authentication

How to write a bot for Kahla

Kahla.SDK Kahla.SDK is a library for writting bots and extends for Kahla. Tutorial - How to create a bot with Kahla.SDK This will introduce how to write a bot for Kahla. Before starting, make sure you have .NET Core SDK installed. Download .NET Core SDK here. 1. Create a new console .NET Core app Open your terminal and type the following command to create a new console app. $ mkdir …

C# .NET Core Aiursoft Kahla Bot Kahla.SDK Kahla App Console App

C#获取腾讯云直播的推流地址和观看地址

最近公司有个项目想对接腾讯云直播。腾讯云直播的推流链接是在客户端生成的,所以这段代码就别指望调用API获取了。 遗憾的是,腾讯云的网站上,只给了Java和PHP的代码示例,并没有给出C#的代码示例: 而我实在看不懂他Java的代码实例中那个txTime参数是从哪冒出来的。自己试了试各种方案,最后终于猜出来,原来是自1970年到今天的总秒数。 剩下的就是求一下MD5,拼接字符串,转一下十六进制。都是体力活,拿C#写也不算费劲。 折腾一阵后,终于搞定。 using System; using System.Security.Cryptography; using System.Text; namespace TencentCloud { public class Program { // Any value is fine. …

C# .NET Core Tencent Cloud Live Streaming China

Use IIS or Azure App Service as a reverse proxy

IIS is a popular web server with awesome GUI management and high performance. And sometimes we just need IIS works as a reverse proxy. Last week, I was building Aiursoft.IO. Aiursoft.IO is a project which reverse-proxies https://probe.aiursoft.com to provide a shorter download URL. And we already have a Windows Server virtual machine and Azure App Service Plan. So we don't plan to buy an …

IIS web.config Reverse Proxy Web Azure App Service Azure

Share view component between different ASP.NET Core web project

When some logic in C# can be shared between projects, we gonna create a new class library project. But sometimes we just want to share some view components. For example, for all pages in Aiursoft, it all contains a Logout component. Writing this more than one time doesn't make sense. So how can we share it? First, we gonna create a new .NET Core class library project alongside it. Name it: …

ASP.NET Core C# class library View component

Limit ASP.NET Core request frequency by IP address

By default, the user can request an ASP.NET Core web server unlimitedly. The user may request our web server very frequently and submit lots of spam data. Also, too frequent requests may be a terrible attack which may cost our service down and lots of money. So how can we group the requests by their IP address, limit the frequency of the user requests, and return an error message? There's …

ASP.NET Core .NET Core IP HTTP

Using IIS and web.config to support large file upload

When you try and upload a large file (over the size limit in IIS) you will see an error message that looks something like: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. By default, IIS web server allows for limited file size to be uploaded to the web …

IIS web.config ASP.NET ASP.NET Core