Copied to clipboard

Flag this post as spam?

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


  • Saied 349 posts 674 karma points
    Oct 13, 2015 @ 11:28
    Saied
    0

    Does umbraco have a way to check which website the user is on?

    I have two umbraco websites (abc.com and def.com). These websites are exactly the same except for one thing, they both return different search results. Currenly, when I hit my search controller, I check Request.Url.Host to see where the user has come from and I change my SQL query to return the correct results, but I was curious if Umbraco had a simpler way to check which site the user is on. Also, I wanted to check earlier in the pipeline, for example if I wanted to make a site wide change depending on their origin, but I am not sure where in Umbraco I would check this.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 13, 2015 @ 12:51
    Dennis Aaen
    0

    Hi Saied,

    Perhaps this package could be an idea to have a look at Personalization-Groups,

    https://our.umbraco.org/projects/website-utilities/personalisation-groups/

    Perhaps you need to write your own regarding to check which website the iser is on. The source code for this package is available here https://github.com/AndyButland/UmbracoPersonalisationGroups

    Hope this helps,

    /Dennis

  • Lars-Erik Aabech 350 posts 1102 karma points MVP 8x c-trib
    Oct 13, 2015 @ 13:24
    Lars-Erik Aabech
    0

    For your reference, there's also

    UmbracoContext.Current.PublishedContentRequest.Domain // A Domain object
    UmbracoContext.Current.PublishedContentRequest.DomainUri // An Uri object
    

    I'd blow this thread up and ask why you use SQL for searching instead of Examine/Lucene, but I'll leave it. ;)

  • Saied 349 posts 674 karma points
    Oct 13, 2015 @ 13:27
    Saied
    0

    Can I use Lucene/Examine to search an external database. I am just using the built in PetaPoco to query my database and map to cusom POCO's. Can I do that with Lucene/Examine? If so, how?

  • Saied 349 posts 674 karma points
    Oct 13, 2015 @ 13:27
    Saied
    0

    Can I use this from Global.asax?

  • Lars-Erik Aabech 350 posts 1102 karma points MVP 8x c-trib
    Oct 13, 2015 @ 13:30
    Lars-Erik Aabech
    0

    I guess you'll have to do some magic to do your own tables.
    It would require some knowledge of Lucene.

    I recommend this book:
    https://www.manning.com/books/lucene-in-action-second-edition

    So SQL is a "cheap" alternative for you, but I highly recommend getting to know Lucene. :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies