Nancy does not display the view and does not expand the layout view

I started learning C # in Mono (Ubuntu) and Nancy , which is a web framework for C #. I use β€œsuper simple view” rendering and I can’t make the code to render the .sshtml file, it just displays as a plan text file. Ultimately, I want to use a layout file ( layout.sshtml ), and each view will replace a part of the layout file.

I have a hunch that perhaps the folder structure is invalid and, for example, login.sshtml does not find layout.sshtml . But I changed the .csproj file to copy the Views folders:

  <Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Debug' "> <!-- needed to deply views folder --> <Exec Command="cp -a Views $(OutDir)" /> <!-- needed to deply database if not newer --> <Exec Command="cp -a -u Database/db.sqlite $(OutDir)" /> </Target> 

I'm just confused why it doesn't display the view. Any help would be appreciated.

This is a link to my repository.

This is the folder structure of my project:

 β”œβ”€β”€ bin β”‚  └── Debug β”‚  β”œβ”€β”€ csharp-practice.exe β”‚  β”œβ”€β”€ csharp-practice.exe.mdb β”‚  β”œβ”€β”€ db.sqlite β”‚  β”œβ”€β”€ Nancy.dll β”‚  β”œβ”€β”€ Nancy.Hosting.Self.dll β”‚  β”œβ”€β”€ nancy-simple-app.exe β”‚  β”œβ”€β”€ nancy-simple-app.exe.mdb β”‚  └── Views β”‚  β”œβ”€β”€ index.sshtml β”‚  β”œβ”€β”€ layout.sshtml β”‚  β”œβ”€β”€ login.sshtml β”‚  └── register.sshtml β”œβ”€β”€ Database β”‚  β”œβ”€β”€ DataBaseManager.cs β”‚  └── db.sqlite β”œβ”€β”€ LICENSE β”œβ”€β”€ nancy-simple-app.csproj β”œβ”€β”€ nancy-simple-app.sln β”œβ”€β”€ nancy-simple-app.userprefs β”œβ”€β”€ obj β”‚  └── x86 β”‚  └── Debug β”‚  β”œβ”€β”€ csharp-practice.csproj.FilesWrittenAbsolute.txt β”‚  β”œβ”€β”€ csharp-practice.exe β”‚  β”œβ”€β”€ csharp-practice.exe.mdb β”‚  β”œβ”€β”€ nancy-simple-app.csproj.FilesWrittenAbsolute.txt β”‚  β”œβ”€β”€ nancy-simple-app.exe β”‚  └── nancy-simple-app.exe.mdb β”œβ”€β”€ packages β”‚  β”œβ”€β”€ Nancy.1.4.3 β”‚  β”‚  β”œβ”€β”€ lib β”‚  β”‚  β”‚  └── net40 β”‚  β”‚  β”‚  β”œβ”€β”€ Nancy.dll β”‚  β”‚  β”‚  └── Nancy.xml β”‚  β”‚  └── Nancy.1.4.3.nupkg β”‚  β”œβ”€β”€ Nancy.Hosting.Self.1.4.1 β”‚  β”‚  β”œβ”€β”€ lib β”‚  β”‚  β”‚  └── net40 β”‚  β”‚  β”‚  β”œβ”€β”€ Nancy.Hosting.Self.dll β”‚  β”‚  β”‚  └── Nancy.Hosting.Self.xml β”‚  β”‚  └── Nancy.Hosting.Self.1.4.1.nupkg β”‚  └── repositories.config β”œβ”€β”€ packages.config β”œβ”€β”€ Program.cs β”œβ”€β”€ Properties β”‚  └── AssemblyInfo.cs β”œβ”€β”€ ViewModels β”‚  └── UserModel.cs └── Views β”œβ”€β”€ index.sshtml β”œβ”€β”€ layout.sshtml β”œβ”€β”€ login.sshtml └── register.sshtml 

Screenshot:

enter image description here

+7
c # mono nancy
source share
1 answer

Found solution, the problem was to use double quotes instead of single quotes in the Views folder

For example, change this:

 @Master["layout"] @Section["content"] This is content on the register page @EndSection 

:

 @Master['layout'] @Section['content'] This is content on the register page @EndSection 

I don’t know why, but he solved the layout problem.

By the day, this is a link to a working site, it’s just a simple login, logout, site registration.

+3
source share

All Articles