Solved: Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list
It turns out that this is because ASP.Net was not completely installed with IIS even though I checked that box in the "Add Feature" dialog. To fix this, I simply ran the following command at the command prompt
If I had been on a 32 bit system, it would have looked like the following:
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
If I had been on a 32 bit system, it would have looked like the following:
%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -iReference: StackOverflow
How to set/change the SQL Server 2008 R2 sa’s password after installation?
In this article we will take a look at how to change SA Password in SQL Server
using TSQL code and by using SQL Server Management Studio. The steps mentioned
in this article are applicable to change any SQL Server Login Password works on
SQL Server 2005 and higher versions.
T-SQL Statement:
Use Master
Go
ALTER LOGIN [sa] WITH PASSWORD=N'JJSqlServer', CHECK_POLICY = OFF
Go
T-SQL Statement:
Use Master
Go
ALTER LOGIN [sa] WITH PASSWORD=N'JJSqlServer', CHECK_POLICY = OFF
Go
Generic Handler to Unpublish Past Events in Umbraco
The following Generic Handler (C#) is used to unpublish the past/old Events automatically after it's expiration date in Umbraco.
Source Code:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Configuration;
- using umbraco.MacroEngines;
- using umbraco.cms.businesslogic.web;
- namespace KPMGAudit.Web.GenericHandlers
- {
- /// <summary>
- /// Summary description for UnpublishExpiredEvents
- /// </summary>
- public class UnpublishExpiredEvents : IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- int EventsNodeId = Convert.ToInt32(ConfigurationManager.AppSettings["EventsNodeId"]);
- string strEventStartDate = string.Empty, strEventEndDate = string.Empty;
- context.Response.ContentType = "text/plain";
- dynamic EventsNode = new DynamicNode().NodeById(EventsNodeId);
- List<DynamicNode> eList = EventsNode.Children.Items;
- foreach (var Event in eList)
- {
- int CurrentEventNodeId = Convert.ToInt32(Event.Id);
- try
- {
- DateTime EventStartDate = Convert.ToDateTime(Event.GetProperty("eventStartDate").Value);
- strEventStartDate = EventStartDate.ToString("MM/dd/yyyy");
- }
- catch { strEventStartDate = string.Empty; }
- try
- {
- DateTime EventEndDate = Convert.ToDateTime(Event.GetProperty("eventEndDate").Value);
- strEventEndDate = EventEndDate.ToString("MM/dd/yyyy");
- }
- catch { strEventEndDate = string.Empty; }
- Document CurrentEventNode = new Document(CurrentEventNodeId);
- if (!string.IsNullOrEmpty(strEventEndDate))
- {
- if (Convert.ToDateTime(strEventEndDate) < DateTime.Now)
- {
- CurrentEventNode.UnPublish();
- }
- }
- else
- {
- if (Convert.ToDateTime(strEventStartDate) < DateTime.Now)
- {
- CurrentEventNode.UnPublish();
- }
- }
- }
- }
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }
- }
- public void UnpublishNode(Document CurrentContentNode, DateTime ContentExpiryDate)
- {
- if (ContentExpiryDate != DateTime.MinValue)
- {
- if (Convert.ToDateTime(ContentExpiryDate) < DateTime.Now)
- {
- CurrentContentNode.UnPublish();
- }
- }
- }
Configuration: (umbracoSettings.config)
- <scheduledTasks>
- <!-- add tasks that should be called with an interval (seconds) -->
- <!-- <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>-->
- <task log="false" alias="ExpiredEventsUnpublishScheduler" interval="60" url="http://local.kpmg.com/GenericHandlers/UnpublishExpiredEvents.ashx"/>
- </scheduledTasks>
Thursday, 7 August 2014
Posted by Jebastin
How to Use CDATA in XML?
All text in an XML document will be parsed by the parser.
But text inside a CDATA section will be ignored by the parser.
XML parsers normally parse all the text in an XML document.
When an XML element is parsed, the text between the XML tags is also parsed:
Characters like "<" and "&" are illegal in XML elements.
"<" will generate an error because the parser interprets it as the start of a new element.
"&" will generate an error because the parser interprets it as the start of an character entity.
Some text, like JavaScript code, contains a lot of "<" or "&" characters. To avoid errors script code can be defined as CDATA.
Everything inside a CDATA section is ignored by the parser.
A CDATA section starts with "<![CDATA[" and ends with "]]>":
Code:
A CDATA section cannot contain the string "]]>". Nested CDATA sections are not allowed.
The "]]>" that marks the end of the CDATA section cannot contain spaces or line breaks.
Reference: W3Schools, StackOverflow
XML parsers normally parse all the text in an XML document.
When an XML element is parsed, the text between the XML tags is also parsed:
<message>This text is also parsed</message>The parser does this because XML elements can contain other elements, as in this example, where the <name> element contains two other elements (first and last):
<name><first>Bill</first><last>Gates</last></name>and the parser will break it up into sub-elements like this:
<name>Parsed Character Data (PCDATA) is a term used about text data that will be parsed by the XML parser.
<first>Bill</first>
<last>Gates</last>
</name>
CDATA - (Unparsed) Character Data
The term CDATA is used about text data that should not be parsed by the XML parser.Characters like "<" and "&" are illegal in XML elements.
"<" will generate an error because the parser interprets it as the start of a new element.
"&" will generate an error because the parser interprets it as the start of an character entity.
Some text, like JavaScript code, contains a lot of "<" or "&" characters. To avoid errors script code can be defined as CDATA.
Everything inside a CDATA section is ignored by the parser.
A CDATA section starts with "<![CDATA[" and ends with "]]>":
<script>In the example above, everything inside the CDATA section is ignored by the parser.
<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
{
return 1;
}
else
{
return 0;
}
}
]]>
</script>
Code:
- string CDATAStart = "<![CDATA[", CDATAEnd = "]]>";
- LongDescription = CDATAStart + mcLongDescription.Trim() + CDATAEnd;
A CDATA section cannot contain the string "]]>". Nested CDATA sections are not allowed.
The "]]>" that marks the end of the CDATA section cannot contain spaces or line breaks.
Reference: W3Schools, StackOverflow
C# Code to implement Google Analytics Tracking Script dynamically
In general we track a page using JavaScript statically. This C# code is used to implement Google Analytics Tracking Script dynamically for every page we want to do it.
Another way: Click here.
Source Code:
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Linq;
- using System.Web;
- namespace KPMGAudit.Web.GoogleAnalytics
- {
- public static class Tracking
- {
- public static string TrackingScript(string url)
- {
- var jsTestString = string.Format(@"
- <script type=""text/javascript"">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', '{0}']);
- _gaq.push(['_trackPageview','{1}']);
- (function() {{
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- }})();
- </script>", ConfigurationManager.AppSettings["GoogleAnalyticsAccountCode"], url);
- return jsTestString;
- }
- }
- }
- // Inject javascript into Long Description
- var url = string.Format("/{0}/{1}", mcContentCategory.AsUrl(), mcTitle.AsUrl());
- mcLongDescription = mcLongDescription + GoogleAnalytics.Tracking.TrackingScript(url);
Another way: Click here.
How to remove the trailing directory slash from the URL?
It's possible to configure Umbraco to remove the final trailing
slash on the URL. If you want to do this, locate the
'umbracoSettings.config' file. This can be found in the
'webroot\config\' directory of your site.
Open this file and locate the 'addTrailingSlash' setting in the 'requestHandler' section of the file.
Open this file and locate the 'addTrailingSlash' setting in the 'requestHandler' section of the file.
<requestHandler>Then all you need to do is to change the addTrailingSlash value to 'false'. Don't forget to save your changes.
<addTrailingSlash>false</addTrailingSlash>
</requestHandler>
Wednesday, 6 August 2014
Posted by Jebastin
How to remove the .ASPX extension from the URL?
First of all, to configure Umbraco to show URL's without the .aspx
extension, you're going to need to locate the 'umbracoUseDirectoryUrls'
setting in the ' appSettings' section of the 'web.config' file for your
site.
<appSettings>Once you've opened this file, all you need to do is change the 'umbracoUseDirectoryUrls' value to 'true'.
<add key="umbracoUseDirectoryUrls" value="true" />
</appSettings>