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
Check the Requested URL The most common cause of a 403 Forbidden Error is simply inputting an incorrect URL. As discussed before, many tightly secured web servers disallow access to improper URLs. This could be anything from accessing a file directory to accessing a private page meant for other users.
Causes of 403 ForbiddenOften, HTTP 403 forbidden errors are caused by an access misconfiguration on the client-side, which means you can usually resolve the issue yourself. A common cause of these errors is the file or folder permission settings, which control who can read, write, and execute the file or folder.
However, if the specified index files are not in the directory, Nginx will return 403 forbidden error. One way to resolve this issue is to add the index file specified in the configuration file or add the available index file to the config file.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With