在一般场景下,通过以下几个步骤我们就可以为 ASP.NET MVC 工程添加 Forms Authentication(表单认证)的支持。
技术
Squirrel Framework 1.0.13 说明文档
Squirrel Framework – 是一个轻量级的 MongoDB 存储封装类库。同时,它还尝试为使用者提供了一系列的拓展类,方便日常的 .NET 开发需求。它致力于让你轻松、快速地构建基于 MongoDB 的应用程序。
下面我们简单介绍一下 Squirrel Framework 的核心功能,只要以下 4 个步骤,你就能完成持久化层的开发。
GitHub 提交忽略规则
我们可以在代码库的根目录创建一个名为 “.gitignore” 的文件,并在其中配置哪些文件或文件夹可以在提交的时候被忽略。以 .NET 项目为例,我们需要忽略与 VS 或 调试编译有关的 bin\obj\packages.vs 等文件或文件夹,则只需要:
# Emacs backup files *~ appsettings.local.json local.settings.json *.pfx # The below are a selected subset from # https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # Visual Studio user-specific files *.suo *.user *.userosscache *.sln.docstates # Build results *.dll *.dll.config *.exe *.exe.config [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ x64/ x86/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ # Visual Studio 2015/2017 cache/options directory .vs/ # Visual Studio 2017 auto generated files Generated\ Files/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* # .NET Core project.lock.json project.fragment.lock.json artifacts/ **/Properties/launchSettings.json # Files built by Visual Studio *_i.c *_p.c *_i.h *.ilk *.meta *.obj *.pch *.pdb *.pgc *.pgd *.rsp *.sbr *.tlb *.tli *.tlh *.tmp *.tmp_proj *.log *.vspscc *.vssscc .builds *.pidb *.svclog *.scc # Visual Studio profiler *.psess *.vsp *.vspx *.sap # Visual Studio Trace Files *.e2e # Visual Studio code coverage results *.coverage *.coveragexml # Click-Once directory publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml # Note: Comment the next line if you want to checkin your web deploy settings, # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj # Microsoft Azure Web App publish settings. Comment the next line if you want to # checkin your Azure Web App publish settings, but sensitive information contained # in these scripts will be unencrypted PublishScripts/ # NuGet Packages *.nupkg # The packages folder can be ignored because of Package Restore **/[Pp]ackages/* # except build/, which is used as an MSBuild target. !**/[Pp]ackages/build/ # Uncomment if necessary however generally it will be regenerated when needed #!**/[Pp]ackages/repositories.config # NuGet v3's project.json files produces more ignorable files *.nuget.props *.nuget.targets # Microsoft Azure Build Output csx/ *.build.csdef # Microsoft Azure Emulator ecf/ rcf/ # Visual Studio cache files # files ending in .cache can be ignored *.[Cc]ache # but keep track of directories ending in .cache !*.[Cc]ache/ # Node.js Tools for Visual Studio .ntvs_analysis.dat node_modules/
注意,按行配置约束,一行一个。
一键清除 .NET 无用文件,清爽一夏
工作几年,电脑里会有很多项目代码,随之而来的就是许许多多调试、编译时带来的 bin/obj/package 或者 .vs 文件(夹),如何清除这些文件,来一个大扫除呢?这里提供一个超有效的 Batch 脚本供参考。
@echo off REM start to clean code folder echo Start to clean all code folder @for /d /r %%c in (obj) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) @for /d /r %%c in (bin) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) @for /d /r %%c in (packages) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) @for /d /r %%c in (.vs) do @if exist "%%c" (@rd /s /q "%%c" & echo Delete %%c) echo Done.
存储为 .bat 文件后,通过命令提示符运行,在我的电脑上运行后,整整节约了 15G 的磁盘空间,泪流满面!
WP2CSDNBlog 已无法同步文章到 CSDN
WP2CSDNBlog 是 WordPress 下的一款优秀的文章同步插件,由于 CSDN 服务器不再支持离线编写了,所以我们无法继续使用这个插件同步新建的 WordPress 文章。(援引插件作者的评论)
不过 博客园 依然可以被 WP2CSDNBlog 插件支持。具体配置信息如下:
- 博客园(CNBlogs):https://rpc.cnblogs.com/metaweblog/nista(修改为你的用户名)
- 开源中国(OSChina):https://my.oschina.net/action/xmlrpc
- 51CTO:http://imguowei.blog.51cto.com/xmlrpc.php
CSDN: http://write.blog.csdn.net/xmlrpc/index新浪博客: http://upload.move.blog.sina.com.cn/blog_rebuild/blog/xmlrpc.php网易(163):http://os.blog.163.com/word
自定义 VSCode 的编辑器配置
打开 VSCode 后,按快捷键 F1 打开 Command palette, 搜索 Open Settings (JSON) 即可启动配置页面,如下图所示。
如何获得在 SharePoint 中保存 Video 并生成缩略图
如果你需要需要在 SharePoint Online 中,上传一个 视频资源,并在自己的定制页面中,引用这个视频,你可以通过如下方法进行操作。
-
Open the SharePoint site and click on “Site Content” on the left panel.
-
Click the “New” button at the top of the site content page and click “Applications” on the menu.
-
Type “Repository” in the search box and click the Asset Library application in the search results.
-
Enter the name of the new asset library and click the “Create” button.
-
Click on the new asset library you created and upload the video file.
如何在 NuGet 发布自己的类库包
我们可以将自己实现的类库发布到 NuGet 上,方便在未来开发应用程序时,对已有代码或结构进行复用。以下是在 NuGet 发布自己类库的一个简单介绍。
- 首先,我们需要到 nuget.org 注册并 获取 API key
-
随后,下载 NuGet 命令行工具,建议将 nuget.exe 注册到系统的环境变量中,方便后续步骤的操作
Continue reading