w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
In Umbraco 6.1.1 MVC 4, how can I do a form post back to a surface controller using a model that inherits from Umbraco's RenderModel?
Ok, I've had no responses to this question but am now in a position to answer it myself. Maybe it was a fundamental oversight, but not that obvious imho, and information on the Umbraco forum etc about inheriting from RenderModel is fairly limited. Essentially the answer, as was my first instinct, is to solve the original exception "No parameterless constructor defined for this object" by providing a paramaterless constructor. The difficulty is working out what to put inside the parameterless constructor for my model, since it inherits from the Umbraco RenderModel which requires an IPublishedContent instance passed to it's constructor. Luckily while browsing around I happened across this post on the Umbraco forum: http://our.umbraco.org/forum/developers/api-questions/40754-Getting-Curre

Categories : Asp Net Mvc

Umbraco MVC Implementation - View does not depend on Umbraco implementations
No you can't. Simply because all requests pass through a single action. In order to retrieve a path to a CMS-managed page, you need to use the node/content traversal the @Model provides. See here for more details on this. Edit To clarify, the author of the article is suggesting that the Umbraco implementation should be more in line with a traditional MVC implementation with little or no logic in the views. Therefore, any querying of node data should happen prior to the view (e.g. in the Mappers). So this is where you would have to retrieve the links. Umbraco's default MVC implementation forces all requests to go via a single action on a single controller. The author's implementation allows the requests to be shared across one controller per document type - which is better IMO. But it st

Categories : Asp Net Mvc

Umbraco - error when using umbraco.library:NiceUrl(...)
Ok I found a solution: I added an extra check to this part: <!-- Return the url --> <xsl:if test="$i = $max"> <xsl:if test="$id != '' "> <xsl:value-of select="umbraco.library:NiceUrl($id)" /> </xsl:if> </xsl:if> this fixed my problem.

Categories : Xslt

Umbraco MediaService / Umbraco MediaItem not saving
To Save media, I found this method with MediaService. However, I think it's possible another method more refined [HttpPost] public JsonResult Upload(HttpPostedFileBase file) { IMedia mimage; // Create the media item mimage = _mediaService.CreateMedia(file.FileName, <parentId>, Constants.Conventions.MediaTypes.Image); mimage.SetValue(Constants.Conventions.Media.File, file); _mediaService.Save(mimage); return Json(new { success = true}); }

Categories : C#

Could not locate Razor Host Factory type: umbraco.MacroEngines.RazorUmbracoFactory, umbraco.MacroEngines
If you are trying to host the blogengine site within a virtual directory of the Umbraco site, then you will have to amend the blogengine web.config to "remove" all the Umbraco-specific handlers and modules, as these will be inherited by the blogengine application, causing this exception because the application can't find the relevant DLLs in its bin folder. I recently had a similar problem and I have posted the web.config I used in the virtual directory below. Mine was a very simple web application, so obviously this will not work by itself in your blogengine app. You will need to add the relevant parts into your web.config file. Also, this was for a v6 Umbraco install in IIS7.5, so you may have to experiment a little. <?xml version="1.0"?> <configuration> <configSecti

Categories : Iis

how do you enable php to enable to make http calls
The thing is that fsockopen is used for opening socks (i.e connect to the specified port on the specified host/IP). When you try to open sock to the host "http://google.com" it is like running "ping http://google.com" - you will get an error - as there is no such host "http://" What you shout do is use http_get or curl <?php $response = http_get("http://www.example.com/", array("timeout"=>1), $info); print_r($info); ?> or remove the "http://" <?php $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br /> "; } else { $out = "GET / HTTP/1.1 "; $out .= "Host: www.example.com "; $out .= "Connection: Close "; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($

Categories : PHP

Upgrading umbraco from 4 to 6
Yes, according to the bug report you can install a Umbraco v4.11.x and then upgrade this to v6.1.x and this should work fine. The downloads are all available here: http://our.umbraco.org/download However, the easiest way to get Umbraco set up is to use NuGet in Visual Studio. So you could run the following line from the NuGet console: Install-Package UmbracoCms -Version 4.11.10 You'll have to use the console for this because if you use the Package manager, it will just install the latest Umbraco package version. Next, load your site in a browser and configure the database settings. Then upgrade using NuGet again. I find the easiest way to do this is to open the NuGet package manager in Visual Studio, select "Updates", find the Umbraco package and click "Update". This will automatical

Categories : Mysql

FileSystemProvider for Umbraco v6.1
Why is it that I spend hours trying to find the answer and then find it soon after I post? The issue was two fold: 1) I should've been implementing IFileSystem (took inspiration from AmazonS3Provider source) 2) the parameter name being passed from FileSystemProviders.config file was not included in the constructor

Categories : C#

URL rewriting in ASP.Net Umbraco
Try: <add name="301_bname" redirectMode="Permanent" ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite" virtualUrl="^~/brands/(.*)" destinationUrl="~/$1" /> The virtualUrl parameter uses a regular expression to match the incoming URL. You can then use the $1 notation to pass the pattern to the destinationUrl parameter. Since both urls are on the same domain, and (I assume) within your web application, you don't need the redirect="Domain" part, and you can use relative URL paths.

Categories : Asp Net

Bootstrap 3 in Umbraco
As far as I know there is no starter kit, or package for it. But it shouldn't be too tough Create your new Umbraco site first, just a bare bones site, no themes, no kits, no packages(yet) Download the new bootstrap files and add the bootstrap img folder and css files to your StyleSheets folder, add the bootstrap.min.js to your Scripts folder. Make a new master/global template that references all of your bootstrap dependencies Make all other templates use this new template as their master. Hope this helps get you going.

Categories : Twitter

How to use RazorPDF in Umbraco 4.11
The best place to start for what you need is here: http://our.umbraco.org/documentation/Reference/Mvc/ But no, strictly speaking you don't need a SurfaceController. You would only need one if you wanted to access the Umbraco context for the requests you are making via the controller. So if you just want to have a controller serve up your PDF, you can have a standard controller implementation. You will have to adjust your routes for this though, and this is all covered in the Umbraco documentation above. Edit: You'll need a route like this: RouteTable.Routes.MapRoute( name: "PdfRazor", url: "PdfCreator/{action}" ); You will also need to add the path to the Web.config for Umbraco to ignore, e.g: <add key="umbracoReservedPaths" value="~/umbraco,~/install,~/pdfcreator" />

Categories : Asp Net Mvc

Umbraco throwing 404
Unfortunately both your links are going to the IIS error page as well as all the other errors on the site so we cant tell what you sitemap should be, see this link for tips on how to set up the 404 page http://www.simonantony.net/knowledge-base/articles/how-to-setup-a-404-error-page-on-your-umbraco-site/ . Make sure that's working across the whole site then with you Google site map is it an XML sitemap or HTML sitemap and how have you implemented it did you use a package or made it you self.

Categories : Iis

Enable/Disable Scrolling in iPhone/iPad’s BUT enable the website scrolling
Check if the device is mobile using a function like this window.mobilecheck = function() { var check = false; (function(a){if(/(android|bbd+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl

Categories : Javascript

Umbraco add CC while sending mails
Umbraco's SendMail() helper method is (purposefully) very basic. It is actually only a few lines that creates a MailMessage instance with the from and to values and sends it via the SmtpClient.Send() method. The ToMail parameter can actually accept multiple email addresses, presumably comma or semi-colon delimited. But these would not be CC recipients. You would actually be be better off just creating your own method.

Categories : Api

Can't download Umbraco CMS with NuGet
Is the space in "Umbraco CMS" the issue? I can nuget it from VS as follows: Tools | Library Package Manager | Package Manager Console PM> install-package umbracocms (hit enter key)

Categories : Visual Studio 2010

Umbraco 6.05 on Windows Azure
There are no different in term of how they store the file whether you use Web Sites or Cloud Services as long as you didn't modify the Umbraco. Both Web Sites and Cloud Services keep the file, in this case, the Media folder in their local storage unless you modify Umbraco to save into Blob Storage to have a better scaling. You can write and modify your own custom Media location or try to look at this URL http://our.umbraco.org/projects/backoffice-extensions/universal-media-picker

Categories : Azure

Umbraco error "Looks like there's still work to do"
I assume you are seeing the error in the database's [umbracoLog] error table? Have you just migrated your site to a new server? If so, your umbraco.config file may be missing. This is usually why you see the "Looks like ..." message, because nothing has previously been published. Also, check the permissions on the site to ensure that modify permissions have been given to the correct folders. If none of these help, one of your doc types or pages may be corrupt, meaning that when a page or pages of a particular doc type are being saved, Umbraco thinks there should be a particular property on the doc type when there isn't. Check the Umbraco logs in the database [umbracoLogs] table, and see if there is a reference to a particular doc type or page being saved. The solution here would be to

Categories : Asp Net

Image rendering in umbraco
So when it doesn't display the images does it not display the whole <li> element? From the piece of code you've given there's nothing there about different logic for the different languages. What if in your XSL template you remove this whole chunk of code and just take it back to basics. <li>test</li> I suspect that the language choice is messing something else up somewhere else in the page. Just try simplifying the page one step at a time by removing the Macros.

Categories : Asp Net

URL rewriting not Working in Umbraco
Try this: <add name="redirect_brands" redirect="Application" redirectMode="Permanent" virtualUrl="^~/brand/(.*)" rewriteUrlParameter="IncludeQueryStringForRewrite" destinationUrl="/$1" ignoreCase="true" /> I think you're missing the ~ in the virtualUrl

Categories : Asp Net

Umbraco css vs images path
Items stored in the media section will have a path like: /media/<row_id>/filename.ext Where <row_id> is literally the id of the row in the database where the media item's information is stored. One way you can determine the path of the media item is to click on the thumbnail (if it's an image) and copy what is in the address bar. You can also access the file by id via a macro using xslt or razor. Here's a razor example: @{ int imageId = 1069; var media = Library.MediaById(imageId); <img src="@media.umbracoFile" alt="" /> } However, this is a content management system, and you will no doubt have end-users managing the content and, therefore, it wouldn't make sense to place design specific images in the media section. A more full-proof approach would b

Categories : CSS

Umbraco quotation marks
Actually I don't think it is putting quotes round it, that's just how your browser is showing the rendered value in its code view. What is happening is that the XSLT is outputting the value as an encoded string instead of unencoded HTML. You need to add the attribute disable-output-escaping="yes" and the outer p tag: <div><xsl:value-of select="./broed" disable-output-escaping="yes" /></div>

Categories : HTML

Get umbraco property with inline C#
If you know the node ID, you could just use new Node(id).GetProperty("protectContent").Value.ToString() == "1" However, if you are on the page you wish to query, you can just use: Node.GetCurrent().GetProperty("protectContent").Value.ToString() == "1" If I'm using masterpages, I like to have a CurrentNode accessor in my codebehind .cs file that returns Node.GetCurrent() but has a backing field so it is not requested each time I call it, e.g. public partial class BaseMaster : System.Web.UI.MasterPage { public Node CurrentNode { get; set; } protected void Page_Load(object sender, EventArgs e) { CurrentNode = Node.GetCurrent(); } }

Categories : C#

Umbraco's useage of Tempdata
It depends on how you set up your instances of Umbraco. I have just set a load-balanced website using Umbraco, and although the published website is load-balanced, the Umbraco back office isn't. This is mainly because it doesn't need to be. You would load-balance an application if the traffic was going to be high enough to warrant it, but with the Umbraco back-office, it's possibly unlikely that it is going to have that load of traffic. Check this article out, it explains some of the options available. I set up the published site to be loadbalanced across two servers. Both instances of the published site resolve against a primary domain (www.site.com), but each instance has a unique, non-loadbalanced sub domain (u1.site.com and u2.site.com). The back office has it's own subdomain (admin

Categories : Asp Net Mvc

Running Umbraco / Mono on OS X
I fairly sure you can't run Umbraco on OSX. However, there are members of the community working on Mono-specific ports of Umbraco. Check out Strawberry Fin's blog for details: http://www.strawberryfin.co.uk/blog/2013/02/02/umbraco-6-is-out-mono-roadmap/

Categories : Osx

Umbraco not rendering IE box shadows
I'm guessing the link to your css is relative or something, it's got absolutely nothing to do with umbraco - you have full control over the html. Perhaps paste a link to your website or your html code. also for cross browser drop shadows you need something like this -moz-box-shadow: 3px 3px 4px #444; -webkit-box-shadow: 3px 3px 4px #444; box-shadow: 3px 3px 4px #444; -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#444444')"; filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#444444');

Categories : HTML

Where is DefaultRenderMvcControllerResolver located in Umbraco Api
The namespace is Umbraco.Web.Mvc but only available from v6.1 onwards I think. All the code is open source and available at https://github.com/umbraco/Umbraco-CMS

Categories : C#

How to integrate my Umbraco site with Worldpay
The first thing you should be considering is how would you usually connect WorldPay to a .Net website. The fact that your site is Umbraco-based needn't complicate things. Find a couple of articles describing integration into a standard .Net website and see if those approaches will work with your website. The only complicating factor might be defining a "callback" page, but then at worst you could just use a hard-coded URL. Many questions like this assume that Umbraco complicates otherwise well-documented tasks. But generally an Umbraco site is still just user controls and masterpages or views and actions. If you want to make the Worldpay configuration editable within Umbraco, that is another question completely.

Categories : C#

Umbraco hook up to load document
One way to do it would to have a separate db table specifically for page hits, e.g. [PageHit] which had two columns [NodeId] and [HitCount]. A hit on a page either created a new record if no hits had previously been recorded, or incremented the count on an existing record. You would need to ensure that the hit was recorded per page, so recording it in the your base Masterpage or in a base Controller would be my approach. You could then have a property based upon a custom datatype that looked up the hit count for the specific node that the property existed upon. The custom datatype could be a usercontrol, and since in the Umbraco backoffice when you load a node in the content editor the node's ID is in the query of the URL, you can access this in the usercontrol to query the database. U

Categories : C#

Building a contact form in Umbraco 6
In this scenario, instead of rendering as a child action: @Html.Action("ContactForm","ContactFormSurface") you should render the view as a partial view: @Html.Partial("ContactFormSurface/ContactForm") ... pointing to where the view is located.

Categories : C#

Colorbox code working outside of Umbraco, but not within
This looks like a problem with how you have implemented your script in Umbraco. Just looking through Chrome's browser inspector, I can see that your script is failing to find the colorbox objects which means that something is prevent the library from being available. This is usually because a dependent javascript library has failed. Looking at your source code, you are loading all your jQuery libraries at the bottom of your page. This is good practice, but you have placed your a second jQuery file reference, your colorbox file references and the custom colorbox code in the head of the page. There are several things you will need to do: Remove the jQuery reference from the head of the page; Move the colorbox file references to the bottom of the page, after all the other javascript file

Categories : Javascript

How to implement Remote validation in Umbraco 6.0 for MVC
It may just be me, but your configured route isn't the same as the URL you are using. You URL starts with /us/ but this is part of the path is missing from your route, so it would throw a 404. You could change your route to "us/Stores/{action}/{id}" perhaps and see if that works.

Categories : C#

Running MVC and Umbraco 4.7 applications in parallel
There are two parts to the answer. Firstly, yes you can. You can host the MVC application as an application within the site in IIS. You will need to ensure that you override all the web.config settings as these settings will be inherited. You will also need to add an the path of your MVC application to the umbracoReservedUrls and/or umbracoReservedPaths appSetting in the Umbraco web.config. However, the second part of the answer is: don't. Do not create and host a separate MVC application purely because you have performance issues in your Umbraco application. Figure out what is causing the performance issues and fix it. It sounds like you are possibly making too many calls to the database, or the calls that you are making aren't optimized. My advise would be to run SQL profiler over the

Categories : C#

Umbraco macro string into KeyValuePair
... Try this: s(?<key>.*?)="(?<value>.*?)" Basically, this will give you 2 named captures: key - This has to begin with whitespace and will be any number of characters until the first =" is encountered value - This will be any number of characters until the next " is encountered And your output would be: key: redirectto || value: /sagen.aspx key: loginpage || value: /Login.aspx key: macroAlias || value: BrowserValidation Hope this does the trick!!

Categories : C#

Language selection with Umbraco and XSLT
I am not sure why you are using the GetRelatedNodesAsXml method. I think you are taking a difficult approach here. I am not sure if you want to display only the flag of the current language or both flags This will display the flag of the current language: <xsl:variable name="languageNode" select="$currentPage/ancestor::*[@level = '1']" /> <ul> <li> <a href="{umbraco.library:NiceUrl($languageNode/@id)}" class="{$languageNode/@nodeName}"> <xsl:value-of select='$languageNode/@nodeName' /></a> </li> </ul> If you want both flags, try this: <ul> <xsl:for-each select="/root/*[@nodeType = 'add the nodeTypeID of your language items']"> <li> <a href="{umbraco.library:NiceUrl(@id)}" class="{@nodeName}"> <x

Categories : Xslt

Umbraco - Getting Page elements by using pageId
It may not appear so, but there is always a parent-child relationship in Umbraco. To explain, each node you create in the content structure is created under a master node which has an ID of -1. So, all nodes are children of this node. Even if your two nodes are in two seemingly independent content branches, they are always related. If your two nodes were both root nodes, from within a cshtml view you can access all root nodes like so: @Umbraco.TypedContentAtRoot() You can then traverse through them like this: @{ var rootNodes = Umbraco.TypedContentAtRoot(); var settingsNode = rootNodes.First(x => x.DocumentTypeAlias == "Settings"); var homeNode = rootNodes.First(x => x.DocumentTypeAlias == "Homepage"); } You can then access the properties on these nodes and displ

Categories : C#

How-to Test if Umbraco property is empty
umbraco.library:GetMedia cannot return null, you may get an error back if no media was matched, in example <error>No media is maching '123123'</error> The thing is that your code works but you dont close the <xsl:attribute name="src"> as you should <xsl:attribute name="src"> <xsl:value-of select="$url" /> </xsl:attribute> If you for some reason really like to ensure that there is an image in there you should write a "test" and count values in the nodeTypeAlias <xsl:variable name="media" select="umbraco.library:GetMedia(sectionImage, 0)" /> <xsl:if test="count($media[@nodeTypeAlias='Image']) > 0"> <xsl:variable name="url" select="$media/umbracoFile" /> <xsl:element name="img"> <xsl:attribute name="src">

Categories : Xslt

Basic Umbraco 6.1.1 SurfaceController Questions
You are using a ChildAction because you are specifying @Html.Action("ContactForm", "ContactSurface") and because of this, in your View you need to: Use Html.BeginForm(...) and not 'Html.BeginUmbracoForm(...)' Allow the form to post back to the same path and not to the action If you do this, then the form will post back to itself as expected. See the documentation here for further help. Edit: Just saw the final part to your question. If you intend SayOK to be your 'thank you' message, I would just call it from your HttpPost action instead of returning the initial view.

Categories : Asp Net Mvc

Umbraco & TFS - Including hidden files
I came across this article which explains how to 'blanket' include files or folders in a .csproj file. In a nutshell you can add the following references: <Content Include="PathToFolder**" /> <Content Include="PathToFolder*.*" /> <Content Include="PathToFolder*.jpg" > So in the case of Umbraco you will first need to exclude the following folders from the project: /umbraco /umbraco_client /media /masterpages /views /macroscripts /xslt then open up the .csproj file in a test editor and add: <Content Include="umbraco**" /> <Content Include="umbraco_client**" /> <Content Include="media**" /> <Content Include="masterpages**" /> <Content Include="views**" /> <Content Include="macroscripts**" /> <Content Include="xslt**" /> S

Categories : Visual Studio 2012

How to implement custom controllers in Umbraco 6
Do you really mean you want a custom controller, or do you actually just want to create a form in Umbraco using MVC? If it's the latter then you need to use a surface controller ie. ensure your controller inherits from Umbraco.Web.Mvc.SurfaceController and has the suffix 'SurfaceController'. public class MySurfaceController : Umbraco.Web.Mvc.SurfaceController { public ActionResult Index() { return Content("hello world"); } } You then need to use the custom Umbraco Html helper to create your form tags: @using(Html.BeginUmbracoForm("CreateComment", "BlogPostSurface")) { // } See http://our.umbraco.org/documentation/Reference/Mvc/forms

Categories : C#

Using page directive instead of master in umbraco
I'm not sure why you're trying to create a child template as a page and not a master and expect it be visible in Umbraco. This isn't how Umbraco works. Whilst in webforms mode, Umbraco only uses masterpages to generate pages. You can create child masterpages and this is a common practice. However 'pages' are created dynamically by Umbraco so you don't have to. If this is confusing you then I'm afraid you're best option is to read the documentation at our.umbraco.org and start with the basics. If you are trying to achieve something specific, then you need to provide more information in your question.

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.