Base solution for your next web application
Open Closed

REMOVING FRONT-END APPLICATION #2577


User avatar
0
rferrari created

Hi,

I followed the indications to remove the front end application provided in this post:

[http://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=5058&hilit=front+end])

That is:

You need to delete HomeController, AboutController and TenantRegistrationController under Controllers folder of MVC project. You also need to remove their *.cshtml files as well.

You also need to change your default route to Account/Login page.

That said the application is correctly rerouting to the login page. My question is if there is a way to reroute to the current angular state and not been logged out.

I am using ASP.NET MVC 5.x & Angularjs 1.x last version.

Thanks


9 Answer(s)
  • User Avatar
    0
    rferrari created

    Sorry, totally silly question as it was written.

    The point is about changing language.

    When you have front end application and you change language you are redirected to home page, but you are still logged in.

    When you remove front end application and you reroute on login page in RouteConfig.cs, if you cahnge language you are sent to the login page.

    Is there a way to be rerouted to the current page after language change?

    Thanks

  • User Avatar
    0
    rferrari created

    Ok in reality vm.changeLanguage in header.js is producing the correct url:

    /AbpLocalization/ChangeCulture?cultureName=it&returnUrl=http://localhost:6240/Application#/tenant/activities
    

    I am missing something in my solution...

  • User Avatar
    0
    rferrari created

    so the issue is that the vm.changeLanguage produce the right url:

    /AbpLocalization/ChangeCulture?cultureName=it&returnUrl=http://localhost:6240/Application#/tenant/organizations
    

    but the get request is truncated after the # sign:

    http://localhost:6240/AbpLocalization/ChangeCulture?cultureName=en&returnUrl=http://localhost:6240/Application
    

    this happens both in Chrome and Edge,

    can you advise?

    Thanks

  • User Avatar
    0
    rferrari created

    This has nothing to do with removing front end application by the way

  • User Avatar
    0
    rferrari created

    Hi, well I did it myself

    The original vm.changeLanguage in header.js used by SPA has a single instruction:

    window.location.href = abp.appPath + 'AbpLocalization/ChangeCulture?cultureName=' 
                         + languageName + '&returnUrl=' + window.location.href;
    

    for what I see AbpLocalization/ChangeCulture is an MVC controller in Abp.Web.Mvc and cannot work inside a SPA. Indeed the return URL is broken at the #.

    I replaced it with the following, this changes the value of the language cookie and reload. As the previous does in MPA.

    vm.changeLanguage = function (languageName) {
           document.cookie = "Abp.Localization.CultureName="+languageName;
           location.reload()
    };
    

    In this way I change language and remain on the page.

    Best regards

  • User Avatar
    0
    rferrari created

    Hi after solving my issue as I said. I thought it is not true an MVC cannot manage a hash url. You do use mvc controller for profile image upload and I use them too in many cases. So I went to github and I discovered:

    Fixed #1840: Language switch return url problem. - fixed 22 days ago

    exactly on Abp.Web.Mvc.

    [https://github.com/aspnetboilerplate/aspnetboilerplate/tree/dev/src/Abp.Web.Mvc/Web/Mvc/Controllers/Localization])

    I am updating from 1.4.1 to 1.4.3 to see if now it works.

    Best regards

  • User Avatar
    0
    rferrari created

    Perfect! It worked!

    Now you could say why a language switch issue is under removing Front-End application. The point is that I realized that the language switch was poorly working only when I removed the front end!

    You can then say that language switch is not so important in my solution if I realized it only for that. That it is true currently, but will not be the same shortly.

    Anyway. It is really important to stay tuned on your changes! Sometimes I think of me as a lone developer, but with Abp I am really part of a development team! (Well in this conversation I was pretty alone, but I think this is because of the misleading subject, usually you reply so promptly)

    Best regards

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I'm really sorry for wasting your time on this issue. Sometimes I cannot even follow issues on ABP :).

  • User Avatar
    0
    rferrari created

    I can imagine! I am happy with the framework in any case

    Have a good day