BlogEngine.NET integration into existing site

Topics: Business Logic Layer
Jan 12, 2011 at 4:42 PM

Hi,

Using the v1.6.1 version of BlogEngine.NET, I was able to integrate it into an existing site. I do remember that was quite easy, just by changing the default blog path in web.config.

I tried to integrate BlogEngine.NET v2.0, into an existing site - it seems like the new version takes no care of the web.config settings about blog's default path; All masterpages' paths are hardcoded, as well as usercontrols' paths; this make impossible to integrate BlogEngine.NET to an existing site.

Is this functionality dropped completely, or is it going to be restored to a later version?

 

Thanks,
George J.

Coordinator
Jan 13, 2011 at 8:30 AM

There's no changes I can think of in BE 2.0 related to anything being hard-coded.  Everything should be as dynamic as it was in BE 1.6.

Jan 13, 2011 at 10:55 AM

If BlogEngine is not located at the root application (if I create an MySite alias and put BE in the subdirectory), I'm getting errors, that the BE directory should be an application. 

eg http://locahost/myapp/blog fails to start.

 

Jan 13, 2011 at 3:35 PM
BenAmada wrote:

There's no changes I can think of in BE 2.0 related to anything being hard-coded.  Everything should be as dynamic as it was in BE 1.6.

 Well, maybe I didn't made clear what I was talking about:

  • File /default.aspx - it references a user control:
    <%@ Register Src="User controls/PostList.ascx" TagName="PostList" TagPrefix="uc1" %>
  • File /admin/dashboard.aspx - it references the masterpage file:
    <%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="Dashboard.aspx.cs" Inherits="Admin.Dashboard" %>

It is obvious that in the first case both default.aspx and User Controls folder, can be moved inside a new folder; this cannot happen on the second case as the path to admin.master is referenced to the root path of the file.

Regards,
George J.

 

 

 

 

Coordinator
Jan 13, 2011 at 4:15 PM

Most likely, second example is default code generation used by Visual Studio when creating new file. If this has issues with integration, we should change it for newly created admin and account pages. I'll set up test integration project and will make sure integration is as easy as it gets, tanks for bringing this up.

Jan 13, 2011 at 6:28 PM
gcapnias wrote:
BenAmada wrote:

There's no changes I can think of in BE 2.0 related to anything being hard-coded.  Everything should be as dynamic as it was in BE 1.6.

 Well, maybe I didn't made clear what I was talking about:

  • File /default.aspx - it references a user control:
    <%@ Register Src="User controls/PostList.ascx" TagName="PostList" TagPrefix="uc1" %>
  • File /admin/dashboard.aspx - it references the masterpage file:
    <%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="Dashboard.aspx.cs" Inherits="Admin.Dashboard" %>

It is obvious that in the first case both default.aspx and User Controls folder, can be moved inside a new folder; this cannot happen on the second case as the path to admin.master is referenced to the root path of the file.

Note that component registration is relevant only at design-time.

Have you managed to make the rest of the site work?

 

Coordinator
Jan 18, 2011 at 7:35 PM
gcapnias wrote:

 Well, maybe I didn't made clear what I was talking about:

  • File /default.aspx - it references a user control:
    <%@ Register Src="User controls/PostList.ascx" TagName="PostList" TagPrefix="uc1" %>
  • File /admin/dashboard.aspx - it references the masterpage file:
    <%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="Dashboard.aspx.cs" Inherits="Admin.Dashboard" %>

It is obvious that in the first case both default.aspx and User Controls folder, can be moved inside a new folder; this cannot happen on the second case as the path to admin.master is referenced to the root path of the file.

Regards,
George J.

Actually, looking at source code for 1.6 - it references master pages exactly same way you describing in your second example:

<%@ Page Language="C#" MasterPageFile="~/admin/admin1.master" AutoEventWireup="true" CodeFile="Blogroll.aspx.cs" Inherits="admin_Pages_blogroll" Title="Blogroll" %>

Jan 20, 2011 at 10:56 AM

I've had a related problem, i went in and changed all the refrenses to admin.master and so on, so all that seems to work, at least the debugger don't complain. But I get the error that the them file can't be found, it's looking in the "main folder" intesad of the "blog" folder, seems like something isn't honoring the relative path? Or is it just me that have missed to do something?

Jan 21, 2011 at 3:49 AM

Can anyone outline the steps to integrate Blog engine alongside an existing site in such a way that the two code bases are not mixed?

I.e. is possible to simply add a subdirectory?

Jan 21, 2011 at 5:45 AM
cjarman wrote:

Can anyone outline the steps to integrate Blog engine alongside an existing site in such a way that the two code bases are not mixed?

I.e. is possible to simply add a subdirectory?

I think, you have options.

I assume your existing site is defined as Application or Virtual Directory, so it's accessed using url in form of www.mydomain.com/myapp

Right click on your Application/Virtual Directory node and select Add Application. Point to BlogEngine. BlogEngine could be in installed into a subdirectory, but it's not necessary. You will be able to acees your blog using www.mydomain.com/myapp/blog

Note that BE alias needs to nested within your app alias.