cshtml pages not rendering correctly

Sep 15, 2011 at 6:50 PM
Edited Sep 15, 2011 at 6:52 PM

Hello!

I'm a new user and .Net programmer (not web), but before I make any change to BlogEngine I want to make sure it runs properly...

... and it doesn't. Well, 95% of it works, but every cshtml page gets poorly rendered.

Below is an example of how the Dashboard is rendered:

 

@using BlogEngine.Core @using BlogEngine.Core.Web.Extensions @{ Page.Title = Resources.labels.dashboard; Layout = "_Layout.cshtml"; }


@Resources.labels.stats

    @Helpers.DashboardHelper.GetStats() 

@Resources.labels.trash
@Resources.labels.viewAll    @Resources.labels.emptyTrash
@Resources.labels.draftPosts@Resources.labels.writeNewPost

    @Helpers.DashboardHelper.GetDraftPosts() 

@Resources.labels.draftPages@Resources.labels.addNewPage

    @Helpers.DashboardHelper.GetDraftPages() 

@Helpers.DashboardHelper.GetLatestComments()
@Resources.labels.latestFromTheGallery
@Helpers.DashboardHelper.GetLatestPackages()
Before i got there, i added a MIME type to my server (hosted at IKoula) as follows:
Extension: .cshtml
Content: text/html
Because without that, it wouldn't get rendered at all (500 error if my memory doesn't fail me).
So i thought IKoula had to install ASP.NET MVC3 to my server, I asked them to and they did it, but the page got rendered exactly the same...
Is this a known bug? How can I fix it?
Thanks!
Sep 15, 2011 at 11:16 PM
Edited Oct 24, 2011 at 9:41 PM

Whats the url to the site?

 

Would like to see whats its generating.

 

Also BlogEngine.net does not use MVC3 it still uses WebForms.

 

Does your server has asp.net  4.0 ?  Need that to run.


Java Blog

Sep 16, 2011 at 7:38 PM
Edited Sep 16, 2011 at 7:45 PM

The URL to the site is http://baboon.eu/ but I'm not sure if there's a public page that displays cshtml.

As far as I know it's the Themes in admin panel and the Dashboard (I heard there's a third one but I don't know where).

Yes my server has asp.net 4.0 and i activated it.

However if BE.Net really doesn't use Razor views, then why are the Razor dlls shipped with the source version?

Sep 16, 2011 at 8:36 PM

Of course it uses Razor... otherwise it wouldn't have those files.

To fix this you must add wildcard mapping to the .net 4.0 iaspi dll.

Sep 16, 2011 at 9:17 PM
Edited Sep 16, 2011 at 9:23 PM

 

I think i read about that, a wildcard with "MVC" name right? Can you provide more info?

Can it be done on shared hosting (I got my own IIS pool, but I'm not alone on the server) ?

The info I found about it is here: http://www.asp.net/mvc/tutorials/using-asp-net-mvc-with-different-versions-of-iis-cs

but it explains how to do it on ASP.NET 2.0, is it the same thing for ASP.NET 4.0?

I'm gonna have to ask my hosting provider to do it for me because I don't have access, so I need to be sure of the procedure...

Sep 16, 2011 at 10:34 PM

Re: Shared host.  Depends on the host, ask them to make the change and see what they say.

Re: How to.  See this thread, post by RockyRoad. http://blogengine.codeplex.com/discussions/265773

Sep 18, 2011 at 1:09 PM

I solved it by adding this line in the <modules> node of web.config:

 

runAllManagedModulesForAllRequests="true"