顯示具有 Umbraco 標籤的文章。 顯示所有文章
顯示具有 Umbraco 標籤的文章。 顯示所有文章

Umbraco v6.1.6 + YAF.NET 2.0 integration

Install memo.

  1. Install Umbraco v6.1.6 (http://our.umbraco.org/contribute/releases/616) by default. appPool: .net v4
  2. Use snippet 2 web.config and modify connection-strings.
  3. Create a test page use asp:LoginView in template , (snipper 1) 
  4. Go to the member section and create 2 Membergroups : Registered and Administrators
  5. Create a Membertype "Registered user" ,  add property "isApproved"  , type : True/False
  6. Create a Member of the type "Registered user" and add it to the "Administrators" group and pick "isApproved" is true
  7. Go to website and login using the user you just created and confirm that it works.
  8. Create yaf folder under Umbraco root , download yaf source(https://github.com/YAFNET/YAFNET/releases/download/v2.0.0/YAF-v2.0.0-BIN.zip) and unzip under yaf folder.
  9. Copy all YAF dll to Umbraco bin folder ~/bin/ , except CookComputing.XmlRpcV2.dll .
  10. Create  folder yaf folder under umbraco bin folder , (~/bin/yaf/), move CookComputing.XmlRpcV2.dll from  ~/yaf/bin/CookComputing.XmlRpcV2.dll to ~/bin/yaf/CookComputing.XmlRpcV2.dll
  11. Modify ~/yaf/app.confg (snippet 3)
  12. restart iis
  13. intall yaf vis {host}/yaf/install.aspx 
snippet 1










snippet 2
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- YAF section Start-->
<section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter, Version=2.0.0.6, Culture=neutral, PublicKeyToken=0573f3650687980d" requirePermission="false" />
<!-- YAF section End-->
<section name="urlrewritingnet" restartOnExternalChanges="true" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
<section name="microsoft.scripting" type="Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
<section name="clientDependency" type="ClientDependency.Core.Config.ClientDependencySection, ClientDependency.Core" requirePermission="false" />
<section name="Examine" type="Examine.Config.ExamineSettings, Examine" requirePermission="false" />
<section name="ExamineLuceneIndexSets" type="Examine.LuceneEngine.Config.IndexSets, Examine" requirePermission="false" />
<section name="FileSystemProviders" type="Umbraco.Core.Configuration.FileSystemProvidersSection, Umbraco.Core" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false" />
<section name="BaseRestExtensions" type="Umbraco.Web.BaseRest.Configuration.BaseRestSection, umbraco" requirePermission="false" />

<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>

</configSections>

<urlrewritingnet configSource="config\UrlRewriting.config" />
<microsoft.scripting configSource="config\scripting.config" />
<clientDependency configSource="config\ClientDependency.config" />
<Examine configSource="config\ExamineSettings.config" />
<ExamineLuceneIndexSets configSource="config\ExamineIndex.config" />
<FileSystemProviders configSource="config\FileSystemProviders.config" />
<log4net configSource="config\log4net.config" />
<BaseRestExtensions configSource="config\BaseRestExtensions.config" />

<appSettings file="yaf\app.config">
<add key="umbracoConfigurationStatus" value="6.1.6" />
<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />
<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/yaf/" />
<add key="umbracoContentXML" value="~/App_Data/umbraco.config" />
<add key="umbracoStorageDirectory" value="~/App_Data" />
<add key="umbracoPath" value="~/umbraco" />
<add key="umbracoEnableStat" value="false" />
<add key="umbracoHideTopLevelNodeFromPath" value="true" />
<add key="umbracoEditXhtmlMode" value="true" />
<add key="umbracoUseDirectoryUrls" value="false" />
<add key="umbracoDebugMode" value="false" />
<add key="umbracoTimeOutInMinutes" value="20" />
<add key="umbracoVersionCheckPeriod" value="7" />
<add key="umbracoDisableXsltExtensions" value="true" />
<add key="umbracoDefaultUILanguage" value="en" />
<add key="umbracoProfileUrl" value="profiler" />
<add key="umbracoUseSSL" value="false" />
<add key="umbracoUseMediumTrust" value="false" />
<add key="umbracoContentXMLUseLocalTemp" value="false" />
<add key="webpages:Enabled" value="false" />
<add key="enableSimpleMembership" value="false" />
<add key="autoFormsAuthentication" value="false" />
<add key="log4net.Config" value="config\log4net.config" />
<add key="YAF.ConfigPassword" value="" />
<add key="YAF.BoardID" value="1" />
<add key="YAF.EnableURLRewriting" value="false" />
<add key="YAF.UrlRewritingFormat" value="standard" />
<add key="YAF.URLRewritingMode" value="Translit" />
<add key="YAF.UseSMTPSSL" value="false" />
<add key="YAF.DatabaseObjectQualifier" value="yaf_" />
<add key="YAF.DatabaseOwner" value="dbo" />
<add key="YAF.ConnectionStringName" value="yafnet" />
<add key="YAF.ProviderExceptionXML" value="ProviderExceptions.xml" />
<add key="YAF.FileRoot" value="~/yaf" />
<add key="YAF.AppRoot" value="~/yaf" />
<add key="YAF.ProviderKeyType" value="System.Guid" />
<add key="YAF.MobileUserAgents" value="iphone,ipad,midp,windows ce,windows phone,android,blackberry,opera mini,mobile,palm,portable,webos,htc,armv,lg/u,elaine,nokia,playstation,symbian,sonyericsson,mmp,hd_mini" />
<add key="YAF.RadEditorSkin" value="Black" />
<add key="YAF.UseRadEditorToolsFile" value="true" />
<add key="YAF.RadEditorToolsFile" value="editors/radEditor/toolsFile.xml" />
<add key="YAF.BaseUrlMask" value="http://localhost/" />
</appSettings>

<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>

<system.net>
<mailSettings>
<!--<smtp>
<network host="127.0.0.1" userName="username" password="password" />
</smtp>-->
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="C:\MailPickup" />
</smtp>
</mailSettings>
</system.net>

<connectionStrings>
<remove name="umbracoDbDSN" />
<add name="umbracoDbDSN" connectionString="server=.;database=PMS;user id=DEV;password=DEV" providerName="System.Data.SqlClient" />
<!-- Important: If you're upgrading Umbraco, do not clear the connection string / provider name during your web.config merge. -->
<!-- YAF connection Start-->
<add name="yafnet" connectionString="Data Source=.;Initial Catalog=YAF;User ID=DEV;Password=DEV" providerName="System.Data.SqlClient" />
<!-- YAF connection END -->
</connectionStrings>

<rewriter configSource="yaf\URLRewriter.config" />

<system.web>
<customErrors mode="RemoteOnly" />
<!-- YAF suggestion
<customErrors defaultRedirect="Error.aspx" mode="Off" />-->
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
<globalization requestEncoding="UTF-8" responseEncoding="UTF-8" />
<xhtmlConformance mode="Strict" />

<httpRuntime requestValidationMode="2.0" enableVersionHeader="false" />

<pages enableEventValidation="false">
<!-- ASPNETAJAX -->
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="umbraco" namespace="umbraco.presentation.templateControls" assembly="umbraco" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<!-- YAF -->
<!-- Default: use non-dynamic (compiled classes) in YAF -->
<add tagPrefix="YAF" namespace="YAF.Controls" assembly="YAF.Controls" />
<add tagPrefix="YAF" namespace="YAF.Controls.Statistics" assembly="YAF.Controls" />
<add tagPrefix="YAF" namespace="YAF.Classes" />
<add tagPrefix="YAF" namespace="YAF" />
</controls>
<namespaces>
<add namespace="YAF.Core" />
<add namespace="YAF.Controls" />
<add namespace="YAF.Utils" />
<add namespace="YAF.Types.Interfaces" />
<add namespace="YAF.Types" />
</namespaces>
</pages>
<httpModules>
<!-- URL REWRTIER -->
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
<!-- UMBRACO -->
<add name="UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />
<!-- ASPNETAJAX -->
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<!-- CLIENT DEPENDENCY -->
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core" />
<!-- YAF.Net Modules -->
<add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" />
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" />
</httpModules>
<httpHandlers>
<remove verb="*" path="*.asmx" />
<!-- ASPNETAJAX -->
<add verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<add verb="*" path="*_AppService.axd" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<!-- UMBRACO CHANNELS -->
<add verb="*" path="umbraco/channels.aspx" type="umbraco.presentation.channels.api, umbraco" />
<add verb="*" path="umbraco/channels/word.aspx" type="umbraco.presentation.channels.wordApi, umbraco" />
<!-- CLIENT DEPENDENCY -->
<add verb="*" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core " />
<!-- SPELL CHECKER -->
<add verb="GET,HEAD,POST" path="GoogleSpellChecker.ashx" type="umbraco.presentation.umbraco_client.tinymce3.plugins.spellchecker.GoogleSpellChecker,umbraco" />
<!-- YAF.Net HTTP handlers -->
<add verb="GET" path="Resource.ashx" type="YAF.YafResourceHandler, YAF" />
</httpHandlers>

<compilation defaultLanguage="c#" debug="false" batch="false" targetFramework="4.0">
<assemblies>
<!-- YAF.Net definitions -->
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<!-- ASP.NET 4.0 Assemblies -->
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>

<buildProviders>
<add extension=".cshtml" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
<add extension=".vbhtml" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
<add extension=".razor" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
</buildProviders>
</compilation>

<authentication mode="Forms">
<forms name="yourAuthCookie" loginUrl="login.aspx" protection="All" path="/" />
</authentication>
<authorization>
<allow users="?" />
</authorization>
<!-- Membership Provider -->
<membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="RegisteredUser" passwordFormat="Hashed" umbracoApprovePropertyTypeAlias="isApproved" />
<add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Hashed" />
</providers>
</membership>
<!-- added by NH to support membership providers in access layer -->
<roleManager enabled="true" defaultProvider="UmbracoRoleProvider">
<providers>
<clear />
<add name="UmbracoRoleProvider" type="umbraco.providers.members.UmbracoRoleProvider" />
</providers>
</roleManager>
<!-- Yaf.Net profile -->
<profile enabled="True" defaultProvider="YafProfileProvider" inherits="YAF.Utils.YafUserProfile">
<providers>
<clear />
<add connectionStringName="yafnet" applicationName="YetAnotherForum" name="YafProfileProvider" type="YAF.Providers.Profile.YafProfileProvider" />
</providers>
</profile>
</system.web>

<!-- ASPNETAJAX -->
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="true" enableCaching="true" />
</scripting>
</system.web.extensions>

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<!-- YAF.Net -->
<remove name="YafTaskModule" />
<remove name="UrlRewriter" />
<add name="YafTaskModule" type="YAF.Core.YafTaskModule, YAF.Core" preCondition="managedHandler" />
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter"
preCondition="managedHandler" />

<!-- Umbraco -->
<remove name="UrlRewriteModule" />
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />

<remove name="UmbracoModule" />
<add name="UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />

<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<remove name="ClientDependencyModule" />
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core" />

<!-- Needed for login/membership to work on homepage (as per http://stackoverflow.com/questions/218057/httpcontext-current-session-is-null-when-routing-requests) -->
<remove name="FormsAuthentication" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
</modules>

<handlers accessPolicy="Read, Write, Script, Execute">
<!-- Yaf.Net -->
<add name="YafHandler" preCondition="integratedMode" verb="GET" path="Resource.ashx"
type="YAF.YafResourceHandler, YAF" />

<!-- Umbraco -->
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<remove name="Channels" />
<remove name="Channels_Word" />
<remove name="ClientDependency" />
<remove name="SpellChecker" />

<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" name="Channels" preCondition="integratedMode" path="umbraco/channels.aspx" type="umbraco.presentation.channels.api, umbraco" />
<add verb="*" name="Channels_Word" preCondition="integratedMode" path="umbraco/channels/word.aspx" type="umbraco.presentation.channels.wordApi, umbraco" />
<add verb="*" name="ClientDependency" preCondition="integratedMode" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core " />
<add verb="GET,HEAD,POST" preCondition="integratedMode" name="SpellChecker" path="GoogleSpellChecker.ashx" type="umbraco.presentation.umbraco_client.tinymce3.plugins.spellchecker.GoogleSpellChecker,umbraco" />
</handlers>

<!-- Adobe AIR mime type -->
<staticContent>
<remove fileExtension=".air" />
<mimeMap fileExtension=".air" mimeType="application/vnd.adobe.air-application-installer-package+zip" />
</staticContent>

<!-- Ensure the powered by header is not returned -->
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>

</system.webServer>

<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<!-- Old asp.net ajax assembly bindings -->
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0" />
</dependentAssembly>

<!-- Ensure correct version of MVC -->
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>

<!-- Ensure correct version of HtmlAgilityPack -->
<dependentAssembly>
<assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
<bindingRedirect oldVersion="1.4.5.0-1.4.6.0" newVersion="1.4.6.0" />
</dependentAssembly>

<!-- ref : http://our.umbraco.org/forum/core/general/6193-Update-CookComputingXmlRpcV2dll?p=1 -->
<dependentAssembly>
<assemblyIdentity name="CookComputing.XmlRpcV2" publicKeyToken="a7d6e17aa302004d" />
<codeBase version="2.5.0.0" href="bin\CookComputing.XmlRpcV2.dll" />
<codeBase version="3.0.0.0" href="bin\YAF\CookComputing.XmlRpcV2.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>

<system.web.webPages.razor>
<host factoryType="umbraco.MacroEngines.RazorUmbracoFactory, umbraco.MacroEngines" />
<pages pageBaseType="umbraco.MacroEngines.DynamicNodeContext">
<namespaces>
<add namespace="Microsoft.Web.Helpers" />
<add namespace="umbraco" />
<add namespace="Examine" />
</namespaces>
</pages>
</system.web.webPages.razor>

</configuration>



snippet 3
<add key="YAF.FileRoot" value="~/yaf" />
<add key="YAF.AppRoot" value="~/yaf" />
<add key="YAF.ProviderKeyType" value="System.Int32" />

[Umbraco] Replace p tags start with root block in TinyMCE Editor

Purpose : Replace <p> to <div>+<br/>

Version: 4.X   ,   File : /config/tinyMceConfig.config

Add TinyMCE configuration key under the <customConfig> element.

<config key="force_p_newlines">false</config>
<config key="force_br_newlines">true</config>    
<config key="forced_root_block">div</config>   

Recycle Application pool.

[Umbraco] Bug in calculating image dimensions in TinyMCE

Encounter in version  4.5.2 & 4.7.1

Update one existing picture by TinyMCE , when change height or width , another one will be changes to NaN.

How to fix:

Add rel in allowedAttributes element

File : /config/umbracoSetting.config

<allowedAttributes>alt,title,border,class,style,align,id,name,onclick,usemap,rel</allowedAttributes>

2. Ensure img element allw rel attribute ,

File : /config/tinyMCEConfig.config

img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel],

[Umbraco] Add User with hashed password & check unique loginname

protected static bool addUmbracoUser(string loginName, string userName, string password)
{
if (ensureUniqueLoginName(account))
{
User u = umbraco.BusinessLogic.User.MakeNew(userName, loginName.Trim(), hashPassword(password), new List < UserType> ());
u.addApplication("content");
u.addApplication("media");
u.addApplication("users");
u.addApplication("settings");
u.addApplication("developer");
u.addApplication("members");
u.Save();
return true;
}
else
{ return false; }
}

private static bool ensureUniqueLoginName(string loginName)
{
umbraco.BusinessLogic.User[] u = umbraco.BusinessLogic.User.getAllByLoginName(loginName);
if (u.Length != 0)
{
return false;
}
return true;
}

private static string hashPassword(string password)
{
HMACSHA1 hash = new HMACSHA1();
hash.Key = Encoding.Unicode.GetBytes(password);

string encodedPassword = Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(password)));
return encodedPassword;
}


Reference: http://our.umbraco.org/wiki/reference/api-cheatsheet/users,-user-types-and-permissions/add-user-with-hashed-password

Security issue – HttpResponse.Redirect in Umbraco appear trace information


If use below solution to implement redirection on your site.
Please ensure hack ~/default.aspx to disable the trace parameter.
<%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="True" Inherits="umbraco.UmbracoDefault" trace="false" validateRequest="false" %>
Please use web debugging tool to check your umbraco site , e.g. Fiddler
You can fellow below step .
1. open Fiddler
2. visit the redirect URL .  
3. in WebView tab , will appear all trace information , like Server Variables , Session State

[Umbraco] Ensure/Check unique user LoginName


private static bool ensureUniqueLoginName(string loginName)
{
umbraco.BusinessLogic.User[] u = umbraco.BusinessLogic.User.getAllByLoginName(loginName);
if (u.Length != 0)
{
return false;
}

return true;
}

[Umbraco] Add more than one TinyMCE datatype on page or usercontrol

        private void addTinyMCEControl(Control targetPlaceHolder, TabPage tp)
{

DataTypeDefinition htmlEditorDataType =
DataTypeDefinition.GetDataTypeDefinition(new Guid("A521511A-7BEE-4C5B-8D7B-4B06B57392B3"));

//The other way can get datatype id directly.
//DataTypeDefinition htmlEditorDataType = DataTypeDefinition.GetDataTypeDefinition(-87);

TinyMCE umbracoTinyMCEEditor = (TinyMCE)htmlEditorDataType.DataType.DataEditor;

string toolbar_id = string.Empty;

if (umbracoTinyMCEEditor != null)
{
if (umbracoTinyMCEEditor.config["umbraco_toolbar_id"] != null)
umbracoTinyMCEEditor.config.Remove("umbraco_toolbar_id");
toolbar_id = "tinyMCEMenu_" + targetPlaceHolder.ClientID;
umbracoTinyMCEEditor.config.Add("umbraco_toolbar_id", toolbar_id);
targetPlaceHolder.Controls.Add(umbracoTinyMCEEditor);
tp.Menu.NewElement("div", toolbar_id, "tinymceMenuBar", 0);
}
}


Reference:


Umbraco v4 - delete Recycle Bin by T-SQL


--Verify the number of nodes returned is the save as the number of nodes that is in the Recycle Bun
--select count(*) from umbracoNode where path like '%-20%' and id!=-20

begin transaction
DELETE FROM umbracoRelation WHERE parentId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
DELETE FROM umbracoRelation WHERE childId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
delete from cmsPreviewXml where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from cmsContentVersion where contentId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from cmsDocument where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from cmsContentXML where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from cmsContent where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from cmsPropertyData where contentNodeId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from umbracoRelation where parentId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from umbracoRelation where childId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from umbracoDomains WHERE domainRootStructureID in (SELECT id FROM umbracoNode WHERE path like '%-20%' and id != -20)
delete from cmsTask where nodeid in (SELECT id FROM umbracoNode WHERE path like '%-20%' and id != -20)
delete from umbracoUser2NodePermission where nodeId in (SELECT id FROM umbracoNode WHERE path like '%-20%' and id != -20)
-- delete the XML nodes....
delete from umbracoNode where path like '%-20%' and id!=-20
commit transaction
--Verify is done , replace rollback to commit

--Reference : http://our.umbraco.org/forum/using/ui-questions/26114-Delete-recycle-bin-problem?p=1

[Umbraco] Item has already been added. Key in dictionary: '??' Key being added: '??'

Error description:

Server Error in '/' Application.


Item has already been added. Key in dictionary: '??'  Key being added: '??'

Description: 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.
Exception Details: System.ArgumentException: Item has already been added. Key in dictionary: '??'  Key being added: '??'
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

DB Log:

At /umbraco/editContent.aspx?id=???? (Referred by: http://localhost/umbraco/umbraco.aspx): System.ArgumentException: Item has already been added. Key in dictionary: '??'  Key being added: '82'     at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)     at umbraco.controls.ContentControl.CreateChildControls()     at System.Web.UI.Control.EnsureChildControls()     at umbraco.controls.ContentControl.OnInit(EventArgs e)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Control.AddedControl(Control control, Int32 index)     at umbraco.cms.presentation.editContent.OnInit(EventArgs e)     at System.Web.UI.Control.InitRecursive(Control namingContainer)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

How to reproduce the problem in my environments.(NOT 100%) : 

1. Create a document type with multiple tabs and inherited other tabs from parents document type.

2. Create a node and get {nodeId}.

3. Open edit page URL http://localhost/umbraco/editContent.aspx?id={nodeId}. on multiple browser (Here I used three difference browsers in the same time. )

3. Run command iisreset

4. Repeated step 2 & 3.

 

Temporary Solution:

1. Recycle Application pool.

2.Type:http://localhost/umbraco/cacheBrowser.aspx?clearByType=umbraco.cms.businesslogic.ContentType

 

Update : 2014.04.23

This is Umbraco bug will affected versions 4.7.0 & 4.8.0 , already fixed in changeset 18d853003c17 in 4.9.0 , the root cause is :
// This class can be cached and potentially shared between multiple threads.
// Two or more threads can attempt to lazyily-load its virtual tabs at the same time.
// If that happens, the m_VirtualTabs will contain duplicates.
// We must prevent two threads from running InitializeVirtualTabs at the same time.
// We must also prevent m_VirtualTabs from being modified while it is being populated.
// optimize, lazy load the data only one time

The issue may occur on every 30 min once the ContentType Cache refresh.

Permanent Solution:

  1. Update source code at /src/umbraco.cms/businesslogic/ContentType.cs , and rebuild source code to get businesslogic.dll
    http://umbraco.codeplex.com/SourceControl/changeset/18d853003c17#src/umbraco.cms/businesslogic/ContentType.cs
  2. Upgrade Umbraco version to v4.9.0

 

More Information :