HttpRequest.AnonymousID プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpRequest.AnonymousID プロパティの意味・解説 

HttpRequest.AnonymousID プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

存在する場合は、ユーザー匿名 ID取得します

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

解説解説
使用例使用例

Global.asax ファイルAnonymousIdentification_OnCreate イベントアクセスして AnonymousId プロパティ使用する方法コード例次に示します。この例は、2 つ部分構成されます。

このコード例最初部分では、Global.asax ファイルAnonymousIdentification_OnCreate イベントアクセスして AnonymousId プロパティ使用する方法示しますAnonymousIdentification_OnCreate イベントは、新し匿名 ID作成されるたびに発生します

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Protected Sub Page_Load(ByVal
 sender As Object, ByVal
 e As System.EventArgs)

    If (Application("UserCount")
 IsNot Nothing) Then
      lblUserCount.Text = Application("UserCount").ToString()
      lblCurrentUser.Text = Request.AnonymousID
    End If
      
  End Sub
  
</script>

<html  >
<head id="Head1" runat="server">
    <title>AnonymousID Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Number of users: 
        <asp:Label ID="lblUserCount" Runat="server"></asp:Label><br
 />
    Current user:
        <asp:Label ID="lblCurrentUser" Runat="server"></asp:Label><br
 />
    </div>
    </form>
</body>
</html>
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
  void Page_Load(object sender, EventArgs e)
    {
      if (Application["UserCount"] != null)
      {
          lblUserCount.Text = Application["UserCount"].ToString();
          lblCurrentUser.Text = Request.AnonymousID;
      }
  }    
</script>


<html  >
<head runat="server">
    <title>AnonymousID Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Number of users: 
        <asp:Label ID="lblUserCount" Runat="server"></asp:Label><br
 />
    Current user:
        <asp:Label ID="lblCurrentUser" Runat="server"></asp:Label><br
 />
    </div>
    </form>
</body>
</html>

コード例2 番目の部分では、前の例の AnonymousIdentification_OnCreate イベントによって作成され新しAnonymousId表示する方法示します

Sub Application_Start(ByVal sender As
 Object, ByVal e As EventArgs)

    'Initialize user count property
    Application("UserCount") = 0

End Sub

Sub AnonymousIdentification_OnCreate(ByVal
 sender As Object, ByVal
 e As AnonymousIdentificationEventArgs)

    ' Change the anonymous id
    e.AnonymousID = "mysite.com_Anonymous_User_" &
 DateTime.Now.Ticks

    ' Increment count of unique anonymous users
    Application("UserCount") = Int32.Parse(Application("UserCount").ToString())
 + 1

End Sub

void Application_Start(Object sender, EventArgs e)
    {
        // Initialize user count property
        Application["UserCount"] = 0;
    }
    
public void AnonymousIdentification_OnCreate(Object
 sender, AnonymousIdentificationEventArgs e)
    {
    // Change the anonymous id
    e.AnonymousID = "mysite.com_Anonymous_User_" + DateTime.Now.Ticks;

    // Increment count of unique anonymous users
    Application["UserCount"] = Int32.Parse(Application["UserCount"].ToString())
 + 1;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

HttpRequest.AnonymousID プロパティのお隣キーワード
検索ランキング

   

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



HttpRequest.AnonymousID プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS