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
-- Umbraco Clear Old Document Versions To Decrease Database Size And Improve Performance | |
-- http://borism.net/2008/12/16/fixing-a-large-cmspropertydata-table-in-umbraco/ | |
--DECLARE @createdDate Datetime = DATEADD(m, -1, getdate()) -- If you want to get 2 weeks without maintenance - 40 minutes to run | |
DECLARE @createdDate Datetime = DATEADD(day, -10, getdate()) -- If you want to get 3/4 weeks without maintenance - 60 minutes to run | |
--select @createdDate | |
-- dump logs | |
-- TRUNCATE TABLE umbracolog -- faster if log table is very big and you don't need anything | |
DELETE FROM umbracolog WHERE Datestamp < @createdDate | |
print 'deleted umbracologs' |
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
public class ProductController : Umbraco.Web.Mvc.RenderMvcController | |
{ | |
public ActionResult ProductPageTemplate(RenderModel model, string productId) | |
{ | |
if(productId.IsValidProductInDatabase()) | |
{ | |
// Product is valid | |
return base.Index(model); | |
} | |
else |
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
using System.Web.Http; | |
[RoutePrefix("api/store")] | |
public class StoreController : Umbraco.Web.WebApi.UmbracoApiController | |
{ | |
[HttpGet] | |
[Route("")] | |
public List<StoreModel> GetAll() | |
{ | |
return StoreManager.GetAll(); |
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
// ADD FOR latest SSL standards | |
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; | |
// IGNORE SSL certification errors | |
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; | |
var url = "https://my.freshdesk.com/"; | |
var username = ConfigurationManager.AppSettings["Freshdesk.AppUsername"]; | |
var key = ConfigurationManager.AppSettings["Freshdesk.AppKey"]; | |
HttpClient client = new HttpClient(); |
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
// mailchimp API add member to list | |
// http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/ | |
// how to get my Id List | |
// https://kb.mailchimp.com/lists/manage-contacts/find-your-list-id | |
var listId = "myListId"; | |
var url = "https://us3.api.mailchimp.com/3.0/lists/" + listId + "/members"; | |
using (HttpClient client = new HttpClient()) |
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
User-agent: * | |
Sitemap: https://www.mywebsite.com/Sitemap.ashx |
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
// for document | |
var udi = new GuidUdi("document", myCurrentNode.GetGuid()); | |
// for media | |
var image = UmbracoHelperContext.TypedMedia(1100); | |
var udi = new GuidUdi("media", image.GetGuid()); | |
// using content service to update images field | |
product.SetValue("images", udi.ToString()); |
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
public class PaginationModel | |
{ | |
public int ItemsPerPage { get; set; } | |
public int CurrentPage { get; set; } | |
public int ListTotalItems { get; set; } | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07"> | |
<rewrites> | |
<!-- | |
URLRewriting.net is obsolete and will be removed from Umbraco in the future. | |
If you want to do rewrites, make sure to use IIS URL rewrite: https://www.iis.net/downloads/microsoft/url-rewrite | |
The advantage of using IIS rewrite is that it is much faster, much less CPU intensive and much less memory intensive. | |
--> | |
<add name="CarDetail" | |
virtualUrl="^~/2017/car/detail/(.*)" |
NewerOlder