Privatization of installing BlogEngine.Net

I have a blogengine.net installation that requires privatization.

I am currently engaged in research, but I must keep my blog / magazine confidential until certain conditions are met.

How can I privatize my blogEngine.net installation so readers need to be logged in to read my posts?

+4
source share
5 answers

I am using this extension. Just save the file as RequireLogin.cs in the App_Code \ Extensions folder and make sure the extension is enabled.

using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using BlogEngine.Core; using BlogEngine.Core.Web.Controls; using System.Collections.Generic; /// <summary> /// Summary description for PostSecurity /// </summary> [Extension("Checks to see if a user can see this blog post.", "1.0", "<a href=\"http://www.lavablast.com\">LavaBlast.com</a>")] public class RequireLogin { static protected ExtensionSettings settings = null; public RequireLogin() { Post.Serving += new EventHandler<ServingEventArgs>(Post_Serving); ExtensionSettings s = new ExtensionSettings("RequireLogin"); // describe specific rules for entering parameters s.Help = "Checks to see if the user has any of those roles before displaying the post. "; s.Help += "You can associate a role with a specific category. "; s.Help += "All posts having this category will require that the user have the role. "; s.Help += "A parameter with only a role without a category will enable to filter all posts to this role. "; ExtensionManager.ImportSettings(s); settings = ExtensionManager.GetSettings("PostSecurity"); } protected void Post_Serving(object sender, ServingEventArgs e) { MembershipUser user = Membership.GetUser(); if(HttpContext.Current.Request.RawUrl.Contains("syndication.axd")) { return; } if (user == null) { HttpContext.Current.Response.Redirect("~/Login.aspx"); } } } 
+1
source

From: BlogEngine.NET 2.5 - Private Blogs

If you enter the control panel, the "Users" tab, the "Roles" tab (right side) for "Anonymous" in the right "Tools" area, hover over it and select "Rights".

You are now on the Rights page for the Anonymous role. Uncheck all the boxes, in particular "View Public Messages." HOWEVER, you need to save at least one element, otherwise everything will return to default. For example, you can save "View Ratings on Posts". Then save.

Then, anyone who is not logged in should automatically be redirected to the login page, regardless of which page they are trying to enter the site on.

+2
source

Lomaxx's answer did not work, so I decided not to make blogengine.net authorization for readers.

on iis, I disabled anonymous access and added guest users to the win2k3 user list.

+1
source

We have created a simple tool that gives certain users access to specific messages according to their ASP.NET membership roles in order to achieve some similar results.

http://blog.lavablast.com/post/2008/08/BlogEnginenet-Post-Security.aspx

+1
source

I would think that this can be done in the web configuration file by doing the following:

 <system.web> <authorization> <allow roles="Admin" /> <deny users="*" /> </authorization> </system.web> 
0
source

Source: https://habr.com/ru/post/1276378/


All Articles