Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
137
rated 0 times [  143] [ 6]  / answers: 1 / hits: 98358  / 8 Years ago, thu, june 16, 2016, 12:00:00

I am trying to learn some things with a source code but when I try to replicate myself this code I am getting that error.



I have a View Index where I am trying to access some .cshtml Templates from another folder.



@{
ViewBag.Title = Index;
}
<div ng-controller=inboxIndexCtrl>
<div class=row>
<div class=col-sm-1>
<a ng-href=#/ id=InboxSubNav>Inbox</a>
<hr />
<a ng-href=#/sent id=InboxSubNav>Sent</a>
<hr />
<a ng-href=#/create id=InboxSubNav>Create</a>
</div>
<div class=col-sm-11>

<div class=well ng-view></div>

</div>

</div>
</div>


Script:



var mail = angular.module('mail', ['ngRoute']);

mail.config([
'$routeProvider', ($routeProvider) => {
$routeProvider.when('/', {
templateUrl: 'Templates/Incoming.cshtml'
})
// Registering path with controller relative to Inbox/Index
// This part is similar to RouteConfig.cs in ASP MVC
.when('/message/:id', {
// Templates are located inside Inbox.
templateUrl: 'Templates/Message.cshtml',
controller: 'oneMessageCtrl'
}).when('/create', {
templateUrl: 'Templates/Create.cshtml',
controller: 'createCtrl'
}).when('/reply/:id', {
templateUrl: 'Templates/Reply.cshtml',
controller: 'replyCtrl'
}).when('/sent', {
templateUrl: 'Templates/Sent.cshtml',
controller: 'sentCtrl'
})

.otherwise({ redirectTo: '/' });

}
]);


_Layout have included ng-app<html ng-app=mail>. Also Angular bundle is loaded before Jquery, and this is done with localhost.



Versions I am using:



Angular 1.3.0-beta4
jquery-1.10.2


When the page loads, for a second it loads the <div class=well ng-view></div> then dissapear.



When I hover the mouse above the links the path seems to be fine. When I click on links it goes on path but doesn't load anything due to 403 error.



Here some the links:



http://localhost:49602/Messages/Index#/
http://localhost:49602/Messages/Index#/sent
http://localhost:49602/Messages/Index#/create


My guess is that I am not using the right versions of Angular/Jquery or am I missing some packages?



Tried to View in browser one Template and got another error:




Server Error in '/' Application.
This type of page is not served.



Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may
be incorrect. Please review the URL below and make sure that it is
spelled correctly.



Requested URL: /Messages/Templates/Create.cshtml



More From » jquery

 Answers
117

Well with the help from stackoverflow I solved the problem:



Here is the solution: Server Error in '/' Application. This type of page is not served



<add key=webpages:Enabled value=true />


It was set on false in my webconfig


[#61737] Wednesday, June 15, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ibrahimr

Total Points: 468
Total Questions: 99
Total Answers: 93

Location: Serbia
Member since Sun, Jul 11, 2021
3 Years ago
;