4

プライベート化が必要な blogengine.net インストールがあります。

現在は研究活動を行っておりますが、一定の条件が整うまでブログ・ジャーナルは非公開とさせていただきます。

blogEngine.net インストールを非公開にして、読者が投稿を読むためにログインしなければならないようにするにはどうすればよいですか?

4

5 に答える 5

2

差出人:BlogEngine.NET2.5-プライベートブログ

コントロールパネルの[ユーザー]タブ、[役割]サブタブ(右側)に移動した場合は、右側の[ツール]領域の[匿名]で、その上にカーソルを合わせて[右]を選択します。

これで、匿名の役割の権利ページが表示されます。すべて、特に「公開投稿を表示」のチェックを外します。ただし、少なくとも1つの項目をチェックしておく必要があります。そうしないと、すべてがデフォルトに戻ります。たとえば、[投稿の評価を表示]をオンのままにしておくことができます。次に保存します。

そうすれば、ログインしていない人は、サイトに入ろうとしているページに関係なく、自動的にログインページにリダイレクトされます。

于 2012-01-12T21:39:25.623 に答える
1

lomaxx の答えはうまくいかなかったので、blogengine.net が読者に対して認証を実行するのを避けることにしました。

iis では、匿名アクセスを無効にし、ゲスト ユーザーを win2k3 ユーザー リストに追加しました。

于 2008-09-08T08:37:50.983 に答える
1

ASP.NET メンバーシップ ロールに従って特定のユーザーが特定の投稿にアクセスできるようにする簡単なツールを作成し、同様の結果を得ました。

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

于 2008-10-04T20:04:00.690 に答える
1

私はこの拡張機能を使用しています。ファイルを RequireLogin.cs として App_Code\Extensions フォルダーに保存し、拡張機能が有効になっていることを確認してください。

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");
        }
    }
}
于 2008-10-21T14:10:39.260 に答える
0

次のようなことを行うことで、Web構成ファイルでこれを行うことが可能だと思います。

<system.web>
    <authorization>
      <allow roles="Admin" />
      <deny users="*" />
    </authorization>
</system.web>
于 2008-08-20T03:49:49.943 に答える