public void PrintProperties(Object obj) { Type type = obj.GetType(); foreach( PropertyInfo p in type.GetProperties()) { Console.Write(p.GetValue()); } }
public void PrintProperties(Object obj) { Type type = obj.GetType(); foreach( PropertyInfo p in type.GetProperties()) { Console.Write(p.GetValue()); } }
我对umbraco 数据表进行的批量更改,但是需要重新生成cmsContentXml表中的内容,该表用于为前端缓存数据创建umbraco.config文件。在Forum搜索了很久才找到现成的方法,本来有文档的,后来地址变了就找不到了,记录下来,防止下次忘记了。
访问你的网站地址 http://YOURDOMAIN/Umbraco/dialogs/republish.aspx?xml=true 点击republish 就完成了,如此简单。。
using Umbraco.Core; using Umbraco.Core.Events; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Services; using System; using System.IO; using System.Text; using System.Configuration; using umbraco.IO; namespace Tmp.PasswordReset { public class RegisterEvents : ApplicationEventHandler { protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { UmbracoApplicationBase.ApplicationInit += ResetAdminPassword; } public void ResetAdminPassword(object sender, EventArgs e) { var userService = ApplicationContext.Current.Services.UserService; var adminUser = userService.GetUserById(0); adminUser.Username = adminUser.Email = "hello@umbraco.org"; adminUser.FailedPasswordAttempts = 0; adminUser.IsLockedOut = false; adminUser.IsApproved = true; userService.SavePassword(adminUser, "123Qwe!"); } } }
在Windows Server 2012之前,在Windows全局程序集缓存(GAC)中安装DLL文件,我一直使用的方法是打开资源管理器中的Windows/Assembly文件夹并简单地拖放文件,或使用GacUtil.exe
不幸的是,使用Windows Server 2012并不那么容易能够在资源管理器中简单地打开GAC并拖放即可。 而且默认情况下服务器上没有GacUtil.exe。
还好有PowerShell来拯救你。 以下是如何将名为“MyDLL.dll”的DLL注册到GAC(以及如何删除它。)
Continue reading 使用PowerShell将程序集(dll)安装到全局程序集缓存(GAC)中 (无需SDK or Visual Studio)
比如下面的Razor视图代码:
@{ ViewBag.Title = "代码改变世界"; } <title>@ViewBag.Title</title>
输出的html代码变成了:
<title>代码改变世界</title>
网上找的备用。
背景是在一个项目中增加临时登录功能,只需验证用户是否登录即可,所需的最低配置与实现代码如下。
在 Startup 的 ConfigureServices() 方法中添加 Authentication 的配置:
services.AddAuthentication(options => { options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme; }).AddCookie();
在 Startup 的 Configure() 方法中将 Authentication 添加到请求管线:
app.UseAuthentication();
在登录程序中验证通过用户名/密码后,通过下面的代码生成登录 Cookie 并发送给客户端:
var claimsIdentity = new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, model.Email) }, "Basic"); var claimsPrincipal = new ClaimsPrincipal(claimsIdentity); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrincipal);
Today I am going to talk to you about a tool that has been shipped within the Umbraco core since v7.1. It powers the Image Cropper property editor but can do much much more to help you build high quality, performant websites. That tool is called ImageProcessor.
ImageProcessor is actually two libraries: ImageProcessor – A library for desktop and web that provides a fluent API allowing you to easily chain methods to deliver the desired output, and ImageProcessor.Web – A web extension to ImageProcessor that allows the developer to perform image manipulation using a Url API of querystring parameters as instructions.
我把Umbrao从7.2.4突然升级到7.5.1.1,发现media丢失了很多。。一部分修复索引解决。。还有一小部分数据库中也没有。。只有手工修复了。。不多,懒于查以前的备份。。留下脚本,以后查看。
微软 Visual Studio Code 免费跨平台代码编辑器 – 支持多种编程语言与系统
在 Build 2015 大会上,微软除了发布了 Microsoft Edge 浏览器和新的 Windows 10 系统外,最大的惊喜莫过于宣布推出免费跨平台的 Visual Studio Code 编辑器了!