Showing posts with label umbraco. Show all posts
Showing posts with label umbraco. Show all posts

Friday, 11 April 2014

HTTPS Redirect Umbraco Package Infinite Redirect Loop

Sources:
I was having this exact same issue with v1.2.0, and spent some time looking at my IIS set-up and certificates and everything was correct but the redirect kept on happening. What was strange was it worked locally but not on my staging environment.
My solution was to changes the host names set-up in Umbraco.
On my local environment (that worked) I had this set-up in "Manage Host Names":
sub.domain.local/en
But on staging (that wasn't working) I had:
So on staging I change this to:
sub.domain.com/en
This worked! So check your hosts names.

Monday, 31 March 2014

Umbraco css folder always modifying files in background without me touching them

I have a GIT repository and I'm using Umbraco. Once strange thing that was happening to me were my files in the css folder kept on being modified even though I wasn't changing them. So every time I wanted to commit a change I'd have to undo the css file changes.

I thought this was Umbraco and because I had my style sheet linked to the rich text editor datatype, but it turned out to be the uSync package. I was synchronizing Stylesheets so by turning this off in the uSyncSettings.config file this stopped the problem. I don't need uSync to manage these files for me.

Umbraco Relationships Datatype

This is a great Umbraco package that helps manage node relationships in multilingual websites. It's just what I was looking for:

Vizioz Relationships Datatype for Umbraco

Wednesday, 19 March 2014

Umbraco fails to Publish! We get an exception within a load balanced environment.

After a deployment to our live servers which are load balanced we could not Publish. We could Save but not right-click publish or by clicking on the icon.

This was the error:

ERROR Umbraco.Web.UmbracoApplication - [Thread 36] An unhandled exception occurred
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.TypeInitializationException: The type initializer for 'umbraco.presentation.cache.dispatcher' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at umbraco.presentation.cache.dispatcher..cctor()
   --- End of inner exception stack trace ---
   at umbraco.presentation.cache.dispatcher.Refresh(Guid factoryGuid, Int32 Id)
   at umbraco.library.UpdateDocumentCache(Document doc)
   at umbraco.cms.presentation.editContent.Publish(Object sender, EventArgs e)
   at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
   at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

This seemed to be an error with the distributed call from server 1 to server 2 in the load balancer.

  1. First I thought it might be a rewrite rule in \config\UrlRewriting.config - it wasn't
  2. Then I recycled the app pools - this didn't help
  3. I then made sure I could access the Umbraco web service on both servers:
    1. http://serverip1/umbraco/webservices/CacheRefresher.asmx - worked
    2. http://serverip2/umbraco/webservices/CacheRefresher.asmx - worked
  4. I disabled distributed calls and then Publish worked, but this wasn't a solution
  5. Finally the solution was due to incorrect config in \config\umbracoSettings.config. I somehow didn't have the <user>0</usertag:

<distributedCall enable="true">

Wednesday, 12 February 2014

Umbraco render macro within macro

I wrote this helper method to easily render macros within other macros when using razor (cshtml) views. This also allows the passing in of parameters. This is an alternative to RenderMacroContent which didn't seem to work for me.

public static string RenderMacro(string alias, int nodeId, Dictionary<string string=> parameters)
        {
            var macroEngine = new RazorMacroEngine();
            var macro = new MacroModel();
            macro.ScriptLanguage = "cshtml";
            macro.ScriptName = alias + ".cshtml";

            foreach (var parameter in parameters)
            {
                macro.Properties.Add(new MacroPropertyModel(parameter.Key, parameter.Value));
            }

            return macroEngine.Execute(macro, new umbraco.NodeFactory.Node(nodeId));
        }


This is the code that wasn't working:

umbraco.library.RenderMacroContent(string.Format("</?UMBRACO_MACRO>", alias, args), model.Id)

Thursday, 28 February 2013

Duplicate trees in Umbraco CMS after uninstalling uComponents

I freaked out when I uninstalled uComponents and discovered that all content, media, settings, and developer trees had all been duplicated. After cleaning my solution and removing all dlls in the bin directory the trees returned to normal.

Wednesday, 23 January 2013

Umbraco drop down list prevalues using razor

Here is a great link that converts the drop down list datatype prevalues into a Dictionary. Hope this helps someone else out there:

http://blog.dampee.be/post/2012/04/15/Get-a-prevalues-dropdownlist-in-Razor-(umbraco)-for-a-datatype.aspx

Monday, 14 January 2013

Umbraco "Oops...the installer can't connect to the repository!"

I was getting this error on a new Umbraco 4.11.1 installation but only when viewing the site from IIS7 and not when running the site from VS 2010. This also made my packages folder in Umbraco developer tab empty.

I had all the correct permissions on my website folder but it was still failing to display when visiting my dev URL setup in IIS.

The solution was to add the same user/group for the website folder to the C:\Windows\Temp folder. Umbraco was failing permissions trying to access this folder.

Hope this helps someone.

Wednesday, 23 March 2011

Setting the first clause in a Lucene query to a SHOULD clause using Umbraco Examine

I'm using Umbraco Examine to index my content by setting up an Index on my Shared document type. I wanted to allow multiple search terms to be looked for in the index regardless of their order. So for example if a search for:

technology portable

or

portable technology

Both technology and portable will be searched for in the index. This was done using GroupOr methods but the problem was the first search term would always be included in the query as a MUST clause. Here is the code.

// Get the search criteria by using our searcher provider and looking only in the content tree of Umbraco.
var criteria = ExamineManager.Instance.SearchProviderCollection["SharedSearcher"].CreateSearchCriteria(IndexTypes.Content);

// Build the search query.
Examine.SearchCriteria.IBooleanOperation query = null;

foreach (var searchTerm in nonEmptySearchTerms)
{
query = query == null ? criteria.GroupedOr(fields, searchTerm.Trim().MultipleCharacterWildcard()) :
query.Or().GroupedOr(fields, searchTerm.Trim().MultipleCharacterWildcard());
}

// Perform the search.
results = ExamineManager.Instance.Search(query.Compile());
results.OrderByDescending(x => x.Score); // Relevance.

The only changed required was in the criteria creation to set the default BooleanOperator to an or, and thus setting the first clause to be SHOULD instead of MUST. Here is the corrected line:

var criteria = ExamineManager.Instance.SearchProviderCollection["SharedSearcher"].CreateSearchCriteria(IndexTypes.Content, BooleanOperation.Or);

Wednesday, 9 March 2011

Default Umbraco Master Page



Manual Umbraco Setup

Setup Umbraco Development Environment

Technologies used:

· Visual Studio 2010

· IIS7 (using hosts file)

· Tortoise-SVN

· Windows 7

· Umbraco 4.6.1

· SQL Server 2008 (management studio)

· .NET 4.0

Get Umbraco

1. Download the version of Umbraco you want from http://umbraco.codeplex.com/releases/view/59502

2. Create an Umbraco folder on your computer where you will extract the files to e.g. C:\Development\Umbraco\4.6.1.

3. Copy the downloaded file to C:\Development\Umbraco\4.6.1 and once there right click on the zip file and select Properties. Under the General tab click Unblock and then Ok.

4. Unzip the files here. They will be extracted into sub-folders but you need to copy the actual files under the build folder into C:\Development\Umbraco\4.6.1.

5. Delete the sub folders generated by un-zipping.

6. Add NetworkService user to C:\Development folder with full permissions.
























Hosts file

7. Click the orb in Windows 7 and type %SystemRoot%\system32\drivers\etc\ into the search textbox and open the folder.

8. Locate the hosts file. This file must not have a extension. Open this file.

9. Add a new entry with the IP 127.0.0.1 (localhost) and space and then your site name e.g. fuelcelltoday.local.

10. Save the file.

11. Click the orb in Windows 7 and type cmd. Once the command line window has opened type ping fuelcelltoday.local and hit enter. If you get a reply then you site is setup correctly.










SQL Server 2008 setup

12. Open SQL Server 2008 Management Studio.

13. Add a new database called e.g. FuelCellToday. This is the database Umbraco will use.

14. Add a new login e.g. fuelcelltoday/password

15. Add a new user e.g. fuelcelltoday/password

IIS7 setup

16. Open IIS7 and right click on Sites then select Add Web Site.

17. Add the site name e.g. FuelCellToday.

18. Point the physical path to C:\Development\Umbraco\4.6.1.

19. Add the host name you chose e.g. fuelcelltoday.local

20. Click Ok.

21. Click on the Application Pools. Right click the application pool created for your site e.g. FuelCellToday and select Advanced Settings.

22. Change the .NET Framework Version to v4.0.

23. Make sure Managed Pipeline Mode is set to Integrated.

24. Set the Identity to NetworkService.

25. Set Load User Profile to False.

26. Click Ok.

Install Umbraco

27. In your browser open the new IIS site URL e.g. http://fuelcelltoday.local.

28. Walk through the Umbraco setup and make sure you select the database we created above. You will also be able to create an admin Umbraco user login during this process. It’s very simple step-by-step process. Once this is done the Umbraco tables will be installed to the database.

29. Test you can login into the Umbraco admin section e.g. http://fuelcelltoday.local/umbraco/umbraco.aspx

30. Test you can see the Umbraco default screen e.g. http://fuelcelltoday.local.

Create SVN repository using Tortoise-SVN

31. In your SVN provider create a new repository e.g. FuelCellToday. Copy the URL created.

32. Create a new folder where the web application will live e.g. C:\Development\Websites.

33. With Tortoise-SVN Checkout the SVN repository here so a new folder is created link to SVN e.g. C:\Development\Websites\FuelCellToday.

Setup Visual Studio 2010 solution

34. Open Visual Studio 2010 and create a new ASP.NET Empty Web Application project. I keep the solution file in the root so I uncheck Create directory for solution option. It’s up to you. Select the folder location you wish to create your project e.g. C:\Development\Websites\FuelCellToday.

35. Copy all the files and folders from the Umbraco folder e.g. C:\Development\Umbraco\4.6.1 to this new website folder. Overwrite any of the files generated by the application with the files from Umbraco folder.

36. In Visual Studio click the Show all files icon in the solution explorer and then Include all the folders and files you just copied into the solution. This might take a while.

37. Build the solution to make sure everything is in order.

Add files to source control using Tortoise-SVN

38. The following files/folders must be ignored. This is so we can easily copy newer versions of Umbraco to this folder and not files that aren’t needed to be under source control:

a. App-Code

b. App-Data

c. bin

d. data

e. install

f. obj

g. python

h. umbraco

i. umbraco_client

j. *.user

k. *.sln

l. *.suo

39. Commit the folder using Tortoise-SVN.

40. Build the solution.

41. Point IIS physical folder to the new website folder e.g. C:\Development\Websites\FuelCellToday.

42. Check the site URLS work e.g. http://fuelcelltoday.local.

New developers

43. Create a checkout folder and download the SVN code e.g. C:\Dev1\Webistes\FuelCellToday.

44. Download Umbraco and unzip files, then copy them into the website folder.

45. Open Visual Studio 2010 and select Open Web Site and select the new folder e.g. C:\Dev1\Webistes\FuelCellToday.

46. Setup IIS as explained above to point to the new folder.

47. Open the site URL.

Sunday, 16 May 2010

Umbraco bug with deleting data types

In Umbraco v4.0.3 I needed to delete a data type I created. Once the data type had been deleted I tried modifying the document type which had a property using the deleted data type, and an error occurred:

Node node exists with id '1609'.

After a lot of searching it seems Umbraco did not delete a record in cmsPropertyType with the dataTypeId = 1609 - the data type I deleted. After deleting this record I could modify the document type without getting an error.