SaaS CMS has officially launched! Learn more now.

trying to create an mvc admin plugin


Ok, here's what I am trying to do. 

I have a page with a listing of companies let's say.

The data itself is coming from the dynamic data store, but that's irrelevant at this stage,

I want the admins to be able to add new companies data. 

So I thought I'd create an admin plugin ( mvc ) to get this to work.

I have been unable to get this plugin to work, here's what I did so far:

I created a new controller called MyExamplePluginController - random name. This controller resides in the normal controllers folder.

The namespace for this class is XX.YY - let's say.

Then I decorated it with this :

Area = EPiServer.PlugIn.PlugInArea.AdminMenu,
Url = "/modules/XX.YY/MyExamplePlugin/Index",
DisplayName = "Company Add Plugin"

I then went and created the folder XX.YY in modules. In that folder I then placed an Index.cshtml view.

At this point if I login to the admin section of the cms I can see my plugin listed. When I click on the link though it throws a 404.

I cannot get this to work in any way shape or form so any ideas are more than welcome at this stage.

I tried to put the controller in the same folder with the view. Didn't help at all.

What am I missing ?

Also please don't point me at any allow resources, I've already been through all the articles and found that they didn't help.

Aug 15, 2014 15:40

Have you tried to follow Pauls guide?

Aug 15, 2014 20:11

What I'm usually doing for this kind of tasks is to add support for single file deployments - controllers, views, etc are bundled together into one .dll file as embedded resources and served by specially registered provider. You can try to sneak some cheats if interested in one of my plugins -

Aug 16, 2014 23:02
Aug 18, 2014 6:57

That is a great tool Valdis and a nice solution with one dll deployment!

Aug 18, 2014 6:57

yes Henrik I did andI got the same thing as the guy who posted the last answer

Aug 18, 2014 10:03

thank you Valdis I was trying to avoid having to create a separate dll for this, but if there is no other way I guess I'll have to

Aug 18, 2014 10:03

It's not that you have to create a separate .dll file for the project. You code is packed in .dll file already anyway. Idea is that you dopn't need to deal with separate files for views, scripts, etc. Everything is embedded inside your main .dll file. It makes testing and debugging addon so much easier - you just drop new .dll file version in your target testing app and debug :) This is really an optional step to take not a prerequisite.

Aug 18, 2014 10:44

Yeah that's exactly the issue. My code is indeed inside the main dll, the problem is that it cannot route the request properly. That's what I am struggling with it and I don't know enough about EPI server to make it work. That's why I am getting a 404 instead of seeing something. If I can make epi server route the request properly then the issue is solved. 

It's not meant to be an add-on, this is something very specific to a project and it won't get reused. This is why I left inside the main project, there's no need for it to be built outside of it.

Aug 18, 2014 10:49

Do you register any custom routes by yourself?

Aug 18, 2014 12:21

I'm trying to create my very first MVC based admin plugin for EPiServer 7.5+... Now how can I reuse the nice EPiServer GUI buttons in my code?

In the plugin, the administrator should be able to select a file (using the EPiServer file picker) and a location where s/he wants to create some global blocks.

Suggestions, anyone?

Mar 06, 2015 17:08

You may achieve this by adding the Episerver system styles as partial view, Anders:

@using EPiServer.Framework.Web.Resources

- Renders necessary Episerver system styles
----------------------------------------------------- *@

@Html.Raw(ClientResources.RenderResources("DojoDashboardCompatability", new[] { ClientResourceType.Style }))


Then refer to this as partial view ( @Html.Partial("~/Views/Shared/yourname.cshtml") ). Then you may use the Episerver guidelines to your service:

Jun 20, 2017 21:22

Here you can find a guide on how to do admin plugin with MVC

Jun 21, 2017 8:56
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.