How to construct URL in pointing to pages in umbraco? - umbraco

How do I construct URL in umbraco? So I have a list of Firms, now when I click on a firm name, I want it to show firm's profile.
Firms list and Firm's profile are two separate user controls and have two Umbraco pages(nodes) embedding the Usercontrol.
So I need dev.xxx.com/322.aspx?firmId=242 but I woulnt know the page name as in 322.apsx and I dont want to hardcode it.
Any ideas?
Chirdeep

You can use the Umbraco built-in UrlRewrite module to create "virtual" pages for your page with firms list and your page with firm's profile.
See my other post for a similar example

Related

Is it possible to programmatically get list of URLs from URL Tracker?

We are using IContentFinder implementation to route Umbraco pages to products in external database. Categories are managed in Umbraco. Turns out, if we rename category, the old CATEGORY page will automatically redirect to the new via (via the URL tracker), but if I open old_category/productId page, redirection does not happen. I need either to get access to all old URLs in order to find the relevant new URL - or check if old_category node redirects to the new URL.
How can I do that programmatically? I'm using Umbraco 7.11
I'm talking about this tab:
The URL Tracker stores its data in the umbracoRedirectUrl table, so you should be able to use this to get what you need.
There are also some DTO's for accessing the data you need in the source code. They might be left as internal, but you could duplicate them for your own use.

Locating Models in the Umbraco hierarchy

I am helping a friend of mine to edit a few things on his website that was built using Umbraco. I am not the original author and I am pretty new to Umbraco but, I can't seem to find the answer anywhere. There is a form that is being used to send an email whenever someone wants to order supplies from the website. The form was previously working. However, he has lost access to the email account and had to create a new one. The problem is I cannot seem to locate the model to look inside of it and change where the emails are being sent.
I cannot locate the Models (there are multiple) in the Umbraco hierarchy even though I can find references to where they're are called inside of the different forms. See below:
#inherits Umbraco.Web.Mvc.UmbracoViewPage<Aeon.Models.OrderSuppliesModel>
I know this is not a URL so I am a little confused on why this is not in any of the Umbraco hierarchy. I know that since it is referencing something and previously worked it has to be there somewhere. The only other place I would think they could be is in the root directory which I don't have access to yet. Could they possibly be located there? Any type of help on this matter would be greatly appreciated.
Since you don't have access to the code, you will have to hope there is a variable somewhere which lets you set the email, rather than it being hardcoded into the controller.
Umbraco nodes
Sometimes Umbraco developers store the email on a field on a node in Umbraco. The common places are:
on the page node which has the form on it
on a settings node
on the home page node
Web.config
The Web.config also has a section which can be used to easily setup variables. Checkout the <appSettings> section to see if there are keys and/or values which might indicate they're used for email.
Also, you haven't specifically said if it is the SMTP email account which has broken, or if it's the email account which submissions are being sent to. Look for the <mailSettings> section on the Web.config if you want to see the SMTP settings. There may be a 'from' field on the <smtp> element.
umbracoSettings.config
In the umbracoSettings.config there is an element which will look something like this:
<notifications>
<!-- the email that should be used as from mail when umbraco sends a notification -->
<email>your#email.here</email>
</notifications>
Forms are not directly handled within Umbraco. I am assuming you are using ver 6+.
To get a form to work you rely on the core MVC functionality, which means you create a Surface Controller with Get and POST actions to handle the logic.
There will be a reference to the specific model being passed to the view within the controller logic, but its common for standard static configuration information to be stored in an Umbraco node itself. Example of such are "SMTP server" "From Address" & "Use Encryption" etc. Some people as an alternative store this information as keys in web.config.
If you are specifically looking to change the model being passed to the form (OrderSuppliesModel), if you are using Visual Studio, the model should be colored in a teal color and when you hover over it, it shows the full namespace. Click it and press F12. This should link you directly to the class module.
hope it helps.
If you're lucky, they're using Umbraco Forms/Contour. When you log into the back office, do you see a section called either "Forms" or "Contour"?
If so, you should be able to find the form in the Forms tree, and at the bottom of the form you should be able to edit the workflows, which will allow you to change who gets emails sent to them etc.
If you don't have those sections, could you post the view that has the form on so we can see what it's doing please?

Trying to create basic blog posts in Umbraco

I've been trying for hours now to add blog posts into our site through the Umbraco back office. It feels so unintuitive how everything works and I'm beginning to get very frustrated, here's what I'm trying to do/have done:
I create a document type, "BlogPost", it contains data that can be entered in a content node relating to the blog post, description, title, etc.
I create a document type, "BlogPage", as a document type to be used as a root content node, which will hold all the BlogPost content nodes, that way I can simply loop through them and render each one on our site
I go to create the BlogPost content node, and it assigns it an url of "/", which simply redirects to the home page
What I don't understand is how am I supposed to just get data that was entered in Umbraco for my view? We have an extremely stylized theme for our site, so I can't use things like Articulate, and I shouldn't have to, all I want to do is store a collection of blog posts together, pull that data from Umbraco, and load it into an ASP.NET view, but there is absolutely zero documentation or examples of how to do this online, I would be incredibly grateful if someone could point me in the right direction on how I should go about doing what I'm trying to do.
If I understand correctly you are developing a blog section on an existing website. First thing to do is inderdaad create a new documenttype for the blogpost itself and add a documenttype for the container of blogposts.
Did you create new templates for these documenttypes? You can find some documentation on templates here
Inside the template you'll want to query data from Umbraco. Information about querying data is available here
Next up is adding the newly created templates to the documenttypes and you're ready to create your content.
Make sure that for the content you create the template is set (see Properties tab), here you can also see the url Umbraco created for the content.
Did you start the Umbraco website from scratch or are you developing on an existing website? Because a blogpost should not redirect to / by default, unless it's the root node of your website. This sounds like custom functiality. Maybe a rewrite or error handling module?
Edit: Also some information on how to get started with templating in Umbraco is available here

Redirect to login page when umbraco site loads

What I want to know is how to redirect the user to the login page, when the website loads. Or if this cant be done, how to change the default page of the website.
when looking for an answer on the internet, i found several solutions mentioning 'nodes' in the content tab. But I have a template installed, and below the content folder, is the
'Business Site' folder which came with my template.
Thanks,
Callum
If you want a whole Umbraco site to require a login set all the pages to restrict their access in the content of the Admin section. In the content section click right on the pages you want to restrict access to and select Public Access.
Child pages will inherit the public access settings from their parents so to restrict access to the whole site select your top home page. When setting the public access restrictions you will be asked for the login and error pages you want to use, so these will need to have been created before hand.
I've just tested this on my Umbraco 6 site, I don't know about other versions.
Start by looking here.
http://www.wiliam.com.au/wiliam-blog/sydney-web-design-umbraco-reserved-properties-and-their-usage
Are you redirecting them to the umbraco backend? Or is the entire site you want protected?
Another good resource is Umbraco TV specifically the role based protection video.

How to use internal links with wildcard items in Sitecore?

I have a multiple site Sitecore solution. All the sites share a product range which is stored inside a 'Shared data' node that sits at the same level as the root nodes of the sites. The individual product pages on a site use a wildcard item to lookup the product based on the last part of the URL.
This means that we can't use internal links in the rich text editor to point to the product page on any of the sites because the product item does not have a specific site URL.
Does anyone know of a way to overcome this, or perhaps know of a way to augment the default behavior of interal links?
Have you considered using cloned items, see here for details.
This would allow you to share the content whilst having the appearance to the end user of the Products being inside the content tree allowing you to use the RTE and internal link look ups?
For extra information about clones, see here and here
You'd also need to do some work in the link provider to link to the cloned version of a product if you wanted. See this question.

Resources