DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Two different DNN sites and one database

 9 Replies
 0 Subscribed to this topic
 40 Subscribed to this forum
Sort:
Author
Messages
Yma
Growing Member
Posts: 29
Growing Member

Hi,

We need to have a public site separately while updating the content through another site with the same database.

For the Public site, Users can browse the content of the site. (example.com)
Users can not log in as a user and authentication has been blocked. Users cannot go to the login page or login to this site. It is for the public view only.

The second site(admin.example.com) will use the same database and the admin will update the content. It has the authentication. 

Please, can I know how to do this? I appreciate your support.

Thank you!

 

Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

Hello:  

It sounds like you can accomplish this by creating two websites on the same DNN instance. 

Then, you'd want to have some sort of routing or rules in place to be sure that only those who should see the "admin" site will be able to. 

This can be done a number of ways, but I'd suggest using two redundant methods.  In this case, I'd first look at applying a <code>redirectRule</code> in the web(dot)config, and another in your website firewall.  This way, if one fails for any reason, the other is still in place.  

Once you have the two sites created, you'll want to link them using the Site Groups feature in the persona bar.  This will allow you to have and use shared content between the two sites.  This way, you can either have "primary" copies of the content on the admin site that feeds the public site, or...  You can have the two sites be duplicates and still do the same thing.  In this case, though, it would be easier to know and see what the impacts of the changes would be since the site is an exact copy. 

(The first example would be faster, using a utilitarian (back-office) approach where you'd simply see content everywhere to edit, without the context and design.)  

As you build out the "admin" site, you'd begin adding an existing module to the "public" site.  As long as the two sites exist and they're grouped, you'll be able to select modules from the "admin" site to place as a linked copy on the "public" site.  

The big caveat here is that you need to be very selective when building and choosing modules for this kind of implementation.  They need to support content sharing.  You should be able to reach out to the respective vendor(s) for any third-party/custom extensions you plan to use and ask them.  

Good luck!  

New Around Here
Posts: 7
New Around Here
May I ask what would be the problem with just hidding the login control and/or using a custom login page, with the link hidden?
Growing Member
Posts: 51
Growing Member
It seems to me that you don't need that much complexity.

The default behaviour is that non-logged in (anonymous) users can only view. Then you can provide suitable accounts for the people/person who makes the changes.

So long as it's OK for anonymous users to see the login page this will do everything you want. If a user has no account then they can't login.
Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!
I don't know if this is any such case, but some corporate sites have the separation of responsibility by website as a requirement. As the others mentioned, it's also possible to just prevent logging in, but that should also be done using multiple (redundant) methods to ensure security - assuming that security is the true requirement here.
Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!

There is another possibility to accomplish this if you need to devide the two websites completely in different folders, but it is a bit tricky, and since a while the DNN installer has no more interface for that.

The idea is to use a so called "Object Qualifier", at least for one site. This has to be defined before the start of installation, by setting the objectQualifier attribute in the web(dot)config file.

<code><add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" <span style="background-color:yellow;">objectQualifier=""</span> databaseOwner="dbo" /></code>

The object qualifier is a string, e.g. "site2". What it does is it puts the string in front of the database objects, the table "Users" becomes "site2_Users", the stored procedure "GetAllUsers" becomes "site2_GetAllUsers" etc.

This explains the specific SQL syntax in DNN installation scripts or the SQL Console, like

<code>SELECT * FROM {databaseOwner}<span style="background-color:yellow;">{objectQualifier}</span>Users</code>

Happy DNNing!
Michael

Michael Tobisch
DNN★MVP

DNN Connect
Veteran Member
Posts: 349
Veteran Member
3 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
Engaged Reader
Engaged Reader
You are an engaged reader!
Avid Reader
Avid Reader
Avid Reader art thou!
ObjectQualifier was removed from the UI for the main reason that so many modules did not support this properly. So if you do plan to go that route, be aware that it would be a bit more brittle since not much testing is done in that "deprecated" scenario.
Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!
Thanks Daniel, I did not know it is "deprecated".

Happy DNNing!
Michael

Michael Tobisch
DNN★MVP

DNN Connect
Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!
Posted By Michael Tobisch on 3/8/2024 1:03 AM
Thanks Daniel, I did not know it is "deprecated".

Happy DNNing!
Michael

Yeah, it will be removed at some point in the future, but I still make sure to include it everywhere until then.  Just in case...  

 

Veteran Member
Posts: 349
Veteran Member
3 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
Engaged Reader
Engaged Reader
You are an engaged reader!
Avid Reader
Avid Reader
Avid Reader art thou!
Posted By Michael Tobisch on 3/8/2024 4:03 AM
Thanks Daniel, I did not know it is "deprecated".

Happy DNNing!
Michael

 

Yeah, so "deprecated" is a big word and we don't have a nice way to migrate forward migrating sites that use it. So it could be supported forever but let's say it is not recommended :) It was useful at a time when having more than one database would incur expensive hosting.

 

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved