Roles.DeleteCookie メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Roles.DeleteCookie メソッドの意味・解説 

Roles.DeleteCookie メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

ロール名がキャッシュされている Cookie削除します

名前空間: System.Web.Security
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Shared Sub DeleteCookie
Roles.DeleteCookie
public static void DeleteCookie
 ()
public:
static void DeleteCookie ()
public static void DeleteCookie
 ()
例外例外
例外種類条件

System.Configuration.Provider.ProviderException

ロール管理有効になっていません。

解説解説
使用例使用例

ユーザーログイン時に DeleteCookie メソッド呼び出してキャッシュされているすべてのロール名をクリアするコード例次に示しますロール管理有効にする Web.config ファイルの例については、Rolesトピック参照してください

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Web.Security"
 %>

<script runat="server">

Public Sub Login_OnClick(sender As
 Object, args As EventArgs)
   If Membership.ValidateUser(UsernameTextbox.Text, PasswordTextbox.Text)
 Then
      Roles.DeleteCookie()
      FormsAuthentication.RedirectFromLoginPage(UsernameTextbox.Text,  NotPublicCheckbox.Checked)
   Else
     Msg.Text = "User authentication failed. Please check your
 username and password and try again."
   End If
End Sub


</script>

<html>
<head>
  <title>Login</title>
</head>
<body>

<form runat="server">
  <h3>Login</h3>

  <asp:Label id="Msg" ForeColor="maroon"
 runat="server" /><BR>

  Username: <asp:Textbox id="UsernameTextbox" runat="server"
 /><BR>
  Password: <asp:Textbox id="PasswordTextbox" runat="server"
 TextMode="Password" /><BR>
 
  <asp:Button id="LoginButton" Text="Login"
 OnClick="Login_OnClick" runat="server"
 />
  <asp:CheckBox id="NotPublicCheckbox" runat="server"
 /> Check here if this is <u>not</u>
 a public computer

</form>

</body>
</html>
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Security" %>

<script runat="server">

public void Login_OnClick(object sender, EventArgs
 args)
{
   if (Membership.ValidateUser(UsernameTextbox.Text, PasswordTextbox.Text))
   {
      Roles.DeleteCookie();
      FormsAuthentication.RedirectFromLoginPage(UsernameTextbox.Text, NotPublicCheckbox.Checked);
   }
   else
     Msg.Text = "User authentication failed. Please check your username and
 password and try again.";
}


</script>

<html>
<head>
  <title>Login</title>
</head>
<body>

<form runat="server">
  <h3>Login</h3>

  <asp:Label id="Msg" ForeColor="maroon" runat="server"
 /><BR>

  Username: <asp:Textbox id="UsernameTextbox" runat="server"
 /><BR>
  Password: <asp:Textbox id="PasswordTextbox" runat="server"
 TextMode="Password" /><BR>
 
  <asp:Button id="LoginButton" Text="Login" OnClick="Login_OnClick"
 runat="server" />
  <asp:CheckBox id="NotPublicCheckbox" runat="server" />
 Check here if this is <u>not</u>
 a public computer

</form>

</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Roles.DeleteCookie メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Roles.DeleteCookie メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS