Getting started with Piranha CMS - asp.net

I Developed an ASP.Net MVC 5 application by using Visual Studio 2012. Now I want to integrate a .Net CMS in my project that supports MVC5, Web API and JSON responses, so I found that Piranha supports MVC 5, but I can't using it I want something good like tutorial to get started with, not the official web site.
Thanks.

Piranha CMS is just a NuGet-package and does not contain any special project features like scaffolding views or generating code for you in your project.
If you're interested in how it works, take a look at the template files that are installed when you install the PiranhaCMSMvc package, but in short:
A request comes in with a permalink to a page or post
The HttpModule gets the entry for the permalink and checks the Route that should be executed for the entry. The default route for pages is ~/page and for posts ~/posts.
The MVC Controller for that route gets the request and loads the full model.
If the controller is correctly implemented it respects the information added for the View in either the Page or Post type or the Page or Post and sends the model to that view.
The page/post types you create in Piranha CMS merely defines what data the model should have, it does not care what you do with it, or where it's sent.
This very loose coupling between the content and the application and its views is why you can integrate Piranha CMS into an already existing application and just use it to store the information you want be dynamic. It is also why there's no themes or pre-generated views for Piranha CMS.
I hope this clarifies usage the mindset of Piranha CMS a bit!
Regards
HÃ¥kan

Related

ASP.NET CORE Application using some Angular 4 pages (--> ASP.NET CORE routing)

We have an existing ASP.NET CORE App with lots of controllers and views (with knockout for 2-way-binding).
Now the requirement is to build new pages (views) with Angular 4 but the rest of the App should stay unchanged.
The management says it should be made like previous knockout extensions which integrate seamlessly in ASP.NET CORE views. This means each page should be a seperate Angular 4 SPA. This requires that routing has to be done with ASP.NET CORE and not Angular 4.
Question: Is this feasible? If yes, how?
Question: Are there better strategies to extend an existing ASP.NET CORE App with Angular 4 parts than this approach?
EDIT:
What I don't understand so far is how to provide routing by ASP.NET CORE in combination with Angular4. In ASP.NET we use _Layout.cshtml for common layout code including a #Html.Partial("_Navigation") for navigation and #RenderBody() for rendering the views. We want to use razor partial views as for the Angular templates. This excellent article describes how.
But how can this be done with ASP.NET routing?
I have found a solution that works for our requirements. For each "mini SPA" I created the necessary files (NgModule, main.ts) to bootstrap them. Then I add a Controller that delivers cshtml-views that contains the load command for the different "mini SPAs". Referencing them in ASP.NET navigation worked like a charm!
One of the key purposes of Angular is to write single page applications (or SPAs). And that does NOT mean what it sounds like. The idea is that the user can seamlessly move from "page" to "page" in the Angular app without hitting the server to ask for the next page. So from the servers perspective, it is providing a single page down to the client ... and then Angular takes over and displays all 10, 50, or 100's of views.
Retaining the ASP.NET routing and rewriting each page in Angular would be pointless.
For a more concrete example, say you have a Product Management application. In Angular you would write every view: Product List, Product Detail, Product Edit, Product History, etc. When the user accesses the app ... all views are downloaded. Then the Angular routing moves the user between these views without needing to hit the server again for another page.
If each of these was an ASP.NET view, then ASP.NET would serve the Product List page. Then if the user moves to view details, they'd have to wait for the server to serve the Product Detail page. Then if the user returns to the Product List page, the user would have to wait for the server to serve the Product List page again.
So my advice is to tell management to take an Angular course (I have one if they are interested) or leave it to the developers to make the appropriate architectural choices. :-)
Seriously though ... it seems like there would be a large expense for very little benefit if you were still planning to serve every individual page from ASP.NET.
And maybe that's the answer here ... ask them what they are truly trying to achieve with a move to Angular.

Mapping web templates inside asp.net mvc Orchard CMS

I want to build a new web site for a construction company. so i find some powerful web templates that support the same business area, such as :-
http://www.templatemonster.com/demo/53844.html
http://www.templatemonster.com/demo/52718.html
now as i am a web developer i can easily update these templates to contain our content. but i need to have a CMS to allow non-IT users to edit the web site. so after doing some search i settle on using Orchard CMS ,, but i need some help in answering these questions:-
i think the main challenge in my case will be to map these web templates inside Orchard.. mainly to modify the web template layout to be Orchard compatible.so my first question is if it supported to have these general web templates to work with Orchard CMS?
second question ,, will there be some limitations when mapping web templetes to be managed inside Orchard CMS.. for example will some UI components stop working?
can some one provide links on how to map web templates inside Orachrd?
since Orchard is based on asp.net mvc. now if i create a new asp.net mvc5 web application, i can easily have these web templates mapped inside my project . this includes modifying the asp.net mvc _layout view and adding the related css & JavaScript.. so is the process to map a web template inside Orcahrd similar to the process of mapping a web template inside a standard asp.net mvc web application ?
Thanks in advance for any help.
Have a look to 1.9. It has this new Templates for pages. SO you could create templates with elements already placed and then users can customise them with data.
You can do it with Widgets too, but requires a bit more admin knowledge... not much.
You could also create a module to hide any functionality behind an as-simple-as-needed UI.
start here: Orchard Docs.
If you are a web developer, start looking at the code and after you get all the Orchard 'aaaahhh' moments, you'll be alright.

Working with both MVC and a WebApi-projects

We have this web.api-project currently residing in api.mydomain.com. It is as a backend for a mobile app and also a superadminlike javascript application. We also have this new public facing website (using Umbraco CMS, in the same VS-solution) wich currently holds just your plain information (with pages like "about us", "get the app" etc) on www.mydomain.com
We've setup a asp.net membership across theese domains and are now looking to find a way to have the public site host pages like login, edit profile, start subscription etc. The controller(s) for theese views exist in the web api-project. Views would presumably exist in the MVC-project.
I am not sure what approach to take. I would preferably be able to use the viewmodels that already exists in the solution and leverage the whole Modelstate/validation-thing, returning View() from the WebApi-project etc.
We could make our edit profile-forms just to POST to the api-project (CORS is a no-go), but then the api project would have to use the hackish Request.CreateResponse in order to redirect the user to some hardcoded place back on the public site, right?
Thanks.
When I've used web-api to talk back and forth to a front-end umbraco site I've tried to make it as dumb as possible and that seems to work well. It feels wrong to couple up you web-api project to do more than send data when requested, using web-api controllers to affect the UI/Views of a website sounds wrong.
Have you considered using Umbraco Members & then configuring them to use asp.net membership (http://our.umbraco.org/wiki/how-tos/membership-providers/how-to-integrate-aspnet-membership-control-with-umbraco) - in that way the Umbraco front-end can deliver tailored stuff to asp.net membership authenticated users without all the to-ing & fro-ing from your web-api?

ASP.NET Pages Pages With CMS System

For the last two weeks I have been searching for a subject...
I'm an ASP.NET C# developer and I want to create a website that allows the use of CMS systems + .net pages,
I have seen some CMS like dotnetnuke, kentico, wordpress, MOTO, and so on...
Now, what is the best way to incorporate these two together... ASP.NET Pages (I create those) and some pages where I want the user to be able to use a CMS system to modify them.
Some people say I can use Wordpress site on one domain, then in the same hosting I create another to host my ASP.NET application... and use links to navigate to each others...
Is this the best way?
I'm completely confused on what to decide.
In Kentico CMS you can benefit from wide range of development models. List of those you could be interested in follows:
Portal engine - pages are completely controlled by Kentico (design, content, properties, etc.)
ASPX - you develop ASPX pages in Visual Studio and use them in Kentico as they are. You can still edit their general properties (regarding urls, security, caching, etc).
Mixed - you create your pages in Visual Studio and use Kentico (server/user) controls which will allow you to edit design & content in Kentico UI.
See Orchard CMS:
http://www.orchardproject.net/
Just assigning the right roles to users you get what you want. This CMS is writen in .Net and it license allows you to use it for any purpose.

How could I use ASP.NET MVC framework in conjunction with my CMS software?

I have been reading on MVC and I created some db-driven pet projects with it and I am very pleased with the shift from WebForms.
However, I have a bit of a limitation that holds me back with WebForms and I was wondering if you could help me with it.
I work for a Web CMS company as a Consultant, therefore all websites (public sites, intranets, extranets, you name it) are based on the CMS software from my company (which should remain nameless).
One of the features that the sales guys like to pitch about our software is its "friendly" urls. Baiscally all data is stored and structured within the CMS like a file system. Then when you point your browser to http://mywebsite.com/about the CMS will return the contents from the item stored under the root with the name "about".
Each item also has a (interchangeable) template registration which is the physical location of the file that is going to display the contents of it (an .aspx page). Just like the "Views" on MVC.
To handle the friendly URLs I have to add a HTTP Handler as follows:
<add verb="*" path="*"
type="Cms.ASPDelivery.HttpRequestHandlerFactory, CmsDelivery" />
That will take care of the friendly URLs and will do the mapping between contents and views.
In an architectural way you could see that just like MVC. The data is stored in the CMS, the presentation is independent of the data, and the handler will be the Controller.
But when it comes down to coding in itself, it is the same old Webforms spagetti.
So, my question is: Do you see any way that I could use both MVC and my CMS' Http Handler?
It depends on the concrete Implementation of the HttpHandler but in most cases it is possible. You have to add the MVC UrlRoutingModule and setup the MVC. I use MVC in a CMS environment with friendly url-s. The CMS is called EPiServer and from what you described it has pretty much the same functionality. I use ASP.NET MVC for the template pages. The path to the physical pages is actually handled by controllers' actions. It works fine and with some tweaking I can say that it is a lot better than WebFroms especially if you develop custom web applications.

Resources