Hi After some research, this is the solution that worked for me:
- Set a razor markdown from nuget
- Change the file structure according to the default behavior of RM [Razor Markdown] in / views
- Change the web configuration according to the approach described in this example service stack
- Change all static htmls files to .cshtml files, this by default creates the same route without extension, for example / views / {Pagename} without extension, I just use this approach to simplify the implementation of authorization logic (at least for me)
- Update the service method with the authorize attribute, which you can find out more on this page.
to illustrate a more illuminated bit, this is the definition of my route so far:
'use strict'; angular.module('myApp', ['myApp.directives', 'myApp.services']).config( ['$routeProvider', function($routeProvider) { $routeProvider.when('/Dashboard', { controller: 'dashboardCtrl', templateUrl: 'Views/dashboard' }).when('/Payments', { controller: 'paymentsCtrl', templateUrl: 'Views/payments' }). when('/Login', { controller: 'loginCtrl', templateUrl: 'Views/login' }); }] );
Note that links are now pointing to the razor path.
This is a small menu I made in angular
<div class="container"> <div class="navbar" ng-controller="indexCtrl"> <div class="navbar-inner"> <a class="brand" href="#/">header menu</a> <ul class="nav"> <li ng-class="{active: routeIs('/Dashboard')}"><a href="#/Dashboard">Dashboard</a></li> <li ng-class="{active: routeIs('/Login')}"><a href="#/Login">Login</a></li> <li ng-class="{active: routeIs('/Payments')}"><a href="#/Payments">payments</a></li> </ul> </div> </div> <ng-view></ng-view> </div>
let's say that the payment page is limited, so every time I click on the page, I get an unauthorized message 401.
Service Host:
public override void Configure(Container container) { Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new FacebookAuthProvider(appSettings), new TwitterAuthProvider(appSettings), new BasicAuthProvider(appSettings), new GoogleOpenIdOAuthProvider(appSettings), new CredentialsAuthProvider() }));
I hope this helps
jack.the.ripper
source share