zoukankan      html  css  js  c++  java
  • Profile学习

     

    ProfileSession很类似,但是Profile是持久对象,强类型。

    Profile的一个小例子,Profile保存的是用户的信息。

    1.      使用Profile必须继承ProfileBase类,ProfileBaseProfile的基类。先新建一个类,名为MyProfile。接下来写代码:

    Imports Microsoft.VisualBasic

    '继承ProfileBase

    Public Class MyProfile

        Inherits ProfileBase

        '属性,可定义其他属性

        Private _userId As String

        Private _password As String

        Public Property UserId() As String

            Get

                Return _userId

            End Get

            Set(ByVal value As String)

                _userId = value

            End Set

        End Property

        Public Property Password() As String

            Get

                Return _password

            End Get

            Set(ByVal value As String)

                _password = value

            End Set

        End Property

        '加载用户信息,也可以从数据读取用户其他信息

        Sub LoadUserInfo()

            Me.UserId = "wood"

            Me.Password = "1@1"

        End Sub

    End Class

    2.      web.config<system.web>中注册

          <!--inherits属性的值是类的名称-->

          <profileinherits="MyProfile"></profile>

    3.      使用Profile

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

            Profile.LoadUserInfo()

            Me.Label2.Text = Profile.UserId.Trim()

        End Sub

    先就学习这么多,有时间再深入学习。

  • 相关阅读:
    英语语法最终珍藏版笔记-9非谓语动词
    英语语法最终珍藏版笔记-8虚拟语气
    英语语法最终珍藏版笔记-7被动语态
    英语语法最终珍藏版笔记-6“情态动词+have+ done”的含义
    photonView 空指针异常
    What is Photon Server?
    photon server (1)
    Unity3D中的Coroutine及其使用(延时、定时调用函数)
    box head上身旋转问题
    unity-点乘和叉乘的应用
  • 原文地址:https://www.cnblogs.com/htht66/p/1236341.html
Copyright © 2011-2022 走看看