+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Clean URL Issue

Clean URL Issue

9 posts, 0 answered
  1. Mateen
    Mateen avatar
    13 posts
    Registered:
    29 Aug 2012
    05 Dec 2013
    Link to this post
    Hi,

    I have an issue regarding urls.
    I have two MVC widgets on two different pages.
    Widget1 : List of Movies I am fetching them from dynamic modules.
    e.g.
    Movies
    abc
    xyz
    mno

    Clicking on each movie I want to redirect it on details page.
    but don't want to pass parameter in querystring
    /moviedetails?moviename = abc

    It should be /moviedetails/abc
    Based on the abc or id, I want to fetch details and show on MovieDetails page.
    I don't have separate moviedetail page for each movie.

    What I tried is
    View
    @Html.ActionLink("abc", "Details", new { Id = 1 });

    Controller of Widget1

    public ActionResult Details(int Id)

    {

    }
    Now from here I want to pass control on another page i.e. /moviedetails/abc and moviename as an parameter.
    And I have to call Detail method or MVC Widget2 which is on Moviedetails page and show the details.

    Please let me know how to handle this, if it has to be done by MapRoute please let me know how to configure it.

    Thanks in advance.

    Regards,
    Mateen
  2. David C
    David C avatar
    33 posts
    Registered:
    02 Dec 2015
    06 Dec 2013
    Link to this post
    Hi Mateen,

    Thanks for contacting us. Can you please confirm whether or not you used Thunder to create your MVC widgets?

    In the meantime you might be interested in taking a look at the following webinar: Developing for Sitefinity with ASP.NET MVC.

    Regards,
    David C
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Chaitanya
    Chaitanya avatar
    22 posts
    Registered:
    14 Oct 2013
    10 Dec 2013 in reply to David C
    Link to this post
    Hi,
    I have a index page where I show the list for dynamic content. On clicking the button it should go to the different page where details are shown. the urls should be of type ~/index/content-type and ~/details/content-type/content-title. how these clean urls can be achieved. I am using mvc widgets for both list as well as details, and want to pass parameters accordingly.

    Thanks in advance.

    Regards,
    Chaitanya 
  4. Mateen
    Mateen avatar
    13 posts
    Registered:
    29 Aug 2012
    10 Dec 2013
    Link to this post
    Hi David,

    Thankx for the reply and sharing the webinar but it is for pure MVC template.
    I am using Sitefinity version 6.1, used thunder to create MVC widgets and my template is Hybrid template. In setting I did EnableBackwardCompatabilityForPagesUrls is true.

    My scenario is:
    2 MVC widgets on two different pages.
    Page Name: E.g. Movies and MovieDetails
    Movie page has list of dynamic module fetching through MVC widgets.
    Onclick of each movie, it should go to MovieDetails page, but url should not be like www.abc.com/movies/moviedetails?parameter=moviename
    e.g.
    www.abc.com/movies/moviedetails?parameter=thor
    Rather it should be
    www.abc.com/movies/thor

    I need to load moviedetails page by passing parameter and need to call controller of MVC widget2 which is placed on that page . But dont to show page name in URL.

    Thanks in advance.
    Kindly reply to this.

    Regards,
    Mateen

  5. Mateen
    Mateen avatar
    13 posts
    Registered:
    29 Aug 2012
    12 Dec 2013
    Link to this post
    Hi David,

    I will be thankful if you could put your inputs on this.

    Regards,
    Mateen
  6. David C
    David C avatar
    33 posts
    Registered:
    02 Dec 2015
    13 Dec 2013
    Link to this post
    Hi Mateen,

    Sorry for the delay in getting back to you. I am currently looking into the answer for you and will reply back shortly.

    Regards,
    David C
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. David C
    David C avatar
    33 posts
    Registered:
    02 Dec 2015
    13 Dec 2013
    Link to this post
    Hi Mateen,

    I've attached my version of what you are doing. I set mine up a bit differently, but achieved the same result. The only difference is instead of having 2 mvc widgets I just have one wdget with 2 views. Basically I route my controller to the details view and pass it the movie name. 

    Take a look.

    Regards,
    David C
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Mateen
    Mateen avatar
    13 posts
    Registered:
    29 Aug 2012
    14 Dec 2013
    Link to this post
    Hi David,
    Thanks a lot for the response.
    I appreciate that you shared demo code, but I am looking something bit different. 
    This works perfect on same page a widget returning two different views.
    But what if I have to put my Details view(MVC widget) on another page.
    I need to achieve exactly same but on another page.
    After going on Detail method I need to load another page e.g. page name MovieDetails
    Url should be: www.abc.com/Movies/Braveheart but page will be MovieDetails.

    View
    <div>@Html.ActionLink(@movie.Name, "Details", "Movies",new {id = @movie.Name},null) - @movie.Year</div>
    MoviesController 
     public ActionResult Details(string id)
            {
               var movieDetails = listfOfMovies.Where(m => m.Name == id);
                return View("Details", movieDetails);
            }

    I hope you got my point.

    Regards,
    Mateen
  9. David C
    David C avatar
    33 posts
    Registered:
    02 Dec 2015
    17 Dec 2013
    Link to this post
    Hi Mateen,

    Sorry for the delay getting back to you. Was digging around looking for some info before I responded. So this has come up before and the responses were basically what I suggested, which is use the 2 views, 1 controller scenario. I realize this doesn't work for you, but here's what I found and what I might suggest... 

    So you your original question... The easy part is that you just construct the link with the variable you mentioned below like you would any standard html link in your view. The issue is that your moviedetails view is going to see the /moviename as a routing parameter, unless you specify it in an ActionLink attribute. Now you could probably fake this out by creating a client side script that store's the movie name in a cookie or session variable and then read it in your Details controller. Here's some info about how you might do this:

    Passing Data in an ASP.NET MVC Application

    If routing is your main obstacle, then another option might be to build a "classic mode" AP.Net MVC widget. This will allow you to register your specific route. Here's some more info:

    Classic MVC mode

    As an alternative have you considered you using Web API in conjunction with your MVC files? This is what I was initially going to recommend to you and I also saw it suggested to others trying to do the same scenario. Here's some info about it:

    Using ASP.NET Web API for Sitefinity REST Services
    Learn About ASP.NET Web API

    Regards,
    David C
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
9 posts, 0 answered