Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Erik 9 posts 29 karma points
    Nov 04, 2013 @ 17:20
    Erik
    0

    Creating top directories out of childnodes in Umbraco?

    Hi guys

     

    First I'd like to thank you for an awesome platform to build websites in. It rocks!

     

    My question for today is:

    I need to make the website able to present +1000 pages in this maner:

    www.mywebdomain.com/subject123

    www.mywebdomain.com/subject126

    www.mywebdomain.com/subject12243

     

    But these nodes are not stored in umbraco admin in this way instead they are stored in a classic hierarchy fashion so that an administrator can find them

    umbraco admin node >> kategory1 >> subject123

    umbraco admin node >> kategory1 >> subject124

    umbraco admin node >> kategory1 >> subject125

    umbraco admin node >> kategory2 >> subject133

    umbraco admin node >> kategory2 >> subject134

    umbraco admin node >> kategory2 >> subject135

    umbraco admin node >> kategory2 >> subject136

     

     

    I have figured out a way to do this programmatically but I am not sure this is the best way. I'd like you guys to comment on the way I have solved this. is this ok considering using load on the umbraco platform?

     

    public class ErpUrlRewriteClass : IHttpModule

    {

    public ErpUrlRewriteClass()

    {

    }

        public void Init(HttpApplication context)

        {

            context.BeginRequest += new EventHandler(context_BeginRequest); 

        }

        void context_BeginRequest(object sender, EventArgs e)

        {

            HttpApplication application = (HttpApplication)sender;

            HttpContext context = application.Context;

     

            string fullOrigionalpath = "";

            fullOrigionalpath = application.Request.Url.ToString();

           string KeyurlToCheck = "";

                if (objMeraLeadsUrlDictionary.MySpecialUrls.ContainsKey(KeyurlToCheck))

                {

                    switch (objMeraLeadsUrlDictionary.MySpecialUrls[KeyurlToCheck])

                    {

                        case 1:

                            application.Context.RewritePath("/ViewCompany/?Company=" + KeyurlToCheck);

                            break;

                        case 2:

                            application.Context.RewritePath("/ViewSubject/?Subject=" + KeyurlToCheck);

                            break;

                        case 3:

                            application.Context.RewritePath("/ViewCategory/?Category=" + KeyurlToCheck);

                            break;

                    }

                }

    }

     

     

    Why I want to do it in this way is because every item on the web I want to have published on the highest level of directory facing the public. But backoffice I want the structure manageble as such I want all the items stored in "folders"/"Directories" in umbraco admin user interface

     

    You can view my first attempt of making these subdirectories. The directory Microsoft and Oracle doesnt exist as nodes in Umbraco toplevel BUT they exist as nodes in a Umbraco admin sublevel named suppliers

    http://www.affärssystemen.se/Microsoft

    http://www.affärssystemen.se/Oracle

     

    www.affärssystemen.se

Please Sign in or register to post replies

Write your reply to:

Draft