Base solution for your next web application
Open Closed

ng-include and cshtml pages #795


User avatar
0
paul lee created

Hi,

I am working on a project which would benefit from using Abp, however, the management doesn't allow me to use the framework per see. So I am trying to grab stuff from Abp where-ever I need them (hope the author of Abp don't mind), hope that one day I can be allowed to transfer this app to use Abp.

At the moment I am trying to get the ng-include to successfully include the header.cshtml. When I ran the webapp, I am getting 403-Forbidden back from ASP.Net for those ng-include(s).

So, please can you explain how can I get cshtml successfully being included?

Thank you very much for your help.


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    No problem to get partially ABP into your project. I did two major thing to make it work:

    1. Request interceptor: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Resources/Abp/Framework/scripts/libs/angularjs/abp.ng.js#L91">https://github.com/aspnetboilerplate/as ... .ng.js#L91</a>
    'request': function (config) {
                            if (endsWith(config.url, '.cshtml')) {
                                config.url = abp.appPath + 'AbpAppView/Load?viewUrl=' + config.url + '&_t=' + abp.pageLoadTime.getTime();
                            }
    
                            return config;
                        },
    
    1. AbpAppView controller: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Mvc/Web/Mvc/Controllers/AbpAppViewController.cs#L10">https://github.com/aspnetboilerplate/as ... ler.cs#L10</a>