Yeah, got that from your link prior.


2009/9/6 Raghupathi Kamuni <[email protected]>:
> http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.add.aspx
>
> public void Add(
>     string name,
>     Object value
> )
>
> if (!String.IsNullOrEmpty(TextBox1.Text) &
>     !String.IsNullOrEmpty(TextBox2.Text))
> {
>  string itemName = Server.HtmlEncode(TextBox1.Text);
>  string itemValue = Server.HtmlEncode(TextBox2.Text);
>  Session.Add(itemName, itemValue);
> }
>
> On Fri, Sep 4, 2009 at 2:36 PM, Andrew Badera <[email protected]> wrote:
>>
>> Interesting, thanks,I tried to get that from searching in a
>> MSDN/VB.NET perspective yesterday (briefly) and couldn't find it.
>>
>> What value does .Add add? Does it simply wrap in null checks under the
>> hood?
>>
>> ∞ Andy Badera
>> ∞ +1 518-641-1280
>> ∞ This email is: [ ] bloggable [x] ask first [ ] private
>> ∞ Google me:
>> http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)
>>
>>
>>
>> 2009/9/4 Raghupathi Kamuni <[email protected]>:
>> > http://msdn.microsoft.com/en-us/library/aa287725(VS.71).aspx
>> >
>> > On Thu, Sep 3, 2009 at 10:58 PM, Andrew Badera <[email protected]> wrote:
>> >>
>> >> a) paste it on pastebin.com. I'm not looking at any more of your code
>> >> until you do. You've lazily pasted an avalanche of text while asking
>> >> for help. Why should people volunteering to help you give themselves a
>> >> headache doing so? I refuse to do so.
>> >>
>> >> b) what is "Session.Add" ??? To add a value, even in non-C#, to
>> >> Session, I'm pretty sure you just use Session("name") = value;
>> >>
>> >> ∞ Andy Badera
>> >> ∞ +1 518-641-1280
>> >> ∞ This email is: [ ] bloggable [x] ask first [ ] private
>> >> ∞ Google me:
>> >> http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)
>> >>
>> >>
>> >>
>> >> On Wed, Sep 2, 2009 at 9:26 PM, Gerard<[email protected]> wrote:
>> >> >
>> >> > here is some of the code:
>> >> >
>> >> > Login Page:
>> >> >
>> >> >  Protected Sub Page_Load(ByVal sender As Object, ByVal e As
>> >> > System.EventArgs) Handles Me.Load
>> >> >        Template.SetSmartPage(Me)
>> >> >        Template.SetKeyCodeEvent(Me.txt_UserID, KeyMode.ToUpperCase)
>> >> >
>> >> >        If Not Me.IsPostBack Then
>> >> >            Template.SetInitialFocus(Me.txt_UserID)
>> >> >
>> >> >            oUserProfile = New UserProfile()
>> >> >
>> >> >             If Not Session("rProfile") Is Nothing Then
>> >> >                Session.Add("Profile", oUserProfile)
>> >> >            Else
>> >> >                Session("UserProfile") = oUserProfile
>> >> >            End If
>> >> >        Else
>> >> >            '
>> >> >        End If
>> >> >    End Sub
>> >> >
>> >> >
>> >> > UserProfile file:
>> >> >
>> >> > Imports System.Data
>> >> > Imports System.Data.OracleClient
>> >> > Imports System.Web.UI
>> >> > Imports System.Web.UI.WebControls
>> >> > Imports System.Configuration
>> >> > Imports Microsoft.VisualBasic
>> >> > Imports CustomApp.DB
>> >> >
>> >> > Public Class UserProfile
>> >> >    Public Enum LogType
>> >> >        Login = 1
>> >> >        Logout = 2
>> >> >    End Enum
>> >> >
>> >> >    Public Enum BoolType
>> >> >        NotSet = -1
>> >> >        No = 0
>> >> >        Yes = 1
>> >> >    End Enum
>> >> >
>> >> >    Private Shared lngSessionID As Long
>> >> >    Private Shared strUserName As String
>> >> >    Private Shared strUserFullNameEN As String
>> >> >    Private Shared strUserFullNameCN As String
>> >> >    Private Shared strUserGroupID As String
>> >> >    Private Shared strDistOfficeCode As String
>> >> >    Private Shared bltUpdateOtherDistrict As BoolType
>> >> >    Private Shared bltEnquiryOtherDistrict As BoolType
>> >> >    Private Shared strLoginIPAddr As String
>> >> >    Private Shared strLoginDatetime As String
>> >> >    Private Shared strLogoutDatetime As String
>> >> >
>> >> >    'Profile Management sub functions
>> >> >    Public Property SessionID() As Long
>> >> >        Get
>> >> >            SessionID = lngSessionID
>> >> >        End Get
>> >> >        Set(ByVal value As Long)
>> >> >            lngSessionID = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property UserName() As String
>> >> >        Get
>> >> >            UserName = strUserName
>> >> >        End Get
>> >> >        Set(ByVal value As String)
>> >> >            strUserName = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property UserFullNameEN() As String
>> >> >        Get
>> >> >            UserFullNameEN = strUserFullNameEN
>> >> >        End Get
>> >> >        Set(ByVal value As String)
>> >> >            strUserFullNameEN = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property UserFullNameCN() As String
>> >> >        Get
>> >> >            UserFullNameCN = strUserFullNameCN
>> >> >        End Get
>> >> >        Set(ByVal value As String)
>> >> >            strUserFullNameCN = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property UserGroupID() As String
>> >> >        Get
>> >> >            UserGroupID = strUserGroupID
>> >> >        End Get
>> >> >        Set(ByVal value As String)
>> >> >            strUserGroupID = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property DistOfficeCode() As String
>> >> >        Get
>> >> >            DistOfficeCode = strDistOfficeCode
>> >> >        End Get
>> >> >        Set(ByVal value As String)
>> >> >            strDistOfficeCode = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property AllowUpdateOtherDistrict() As BoolType
>> >> >        Get
>> >> >            AllowUpdateOtherDistrict = bltUpdateOtherDistrict
>> >> >        End Get
>> >> >        Set(ByVal value As BoolType)
>> >> >            bltUpdateOtherDistrict = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property AllowEnquiryOtherDistrict() As BoolType
>> >> >        Get
>> >> >            AllowEnquiryOtherDistrict = bltEnquiryOtherDistrict
>> >> >        End Get
>> >> >        Set(ByVal value As BoolType)
>> >> >            bltEnquiryOtherDistrict = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property LoginIPAddr() As String
>> >> >        Get
>> >> >            LoginIPAddr = strLoginIPAddr
>> >> >        End Get
>> >> >        Set(ByVal value As String)
>> >> >            strLoginIPAddr = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property LoginDatetime() As String
>> >> >        Get
>> >> >            LoginDatetime = strLoginDatetime
>> >> >        End Get
>> >> >        Set(ByVal value As String)
>> >> >            strLoginDatetime = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Property LogoutDatetime() As String
>> >> >        Get
>> >> >            LogoutDatetime = strLogoutDatetime
>> >> >        End Get
>> >> >        Set(ByVal value As String)
>> >> >            strLogoutDatetime = value
>> >> >        End Set
>> >> >    End Property
>> >> >
>> >> >    Public Function LogUserAction(Optional ByVal l_Type As LogType =
>> >> > LogType.Login) As Boolean
>> >> >        Dim blnSuccess As Boolean = False
>> >> >        Dim pa_Data As OracleParameterCollection
>> >> >
>> >> >        Try
>> >> >            pa_Data = New OracleParameterCollection()
>> >> >
>> >> >            pa_Data.Add("out_log_datetime", OracleType.VarChar, 20)
>> >> >            pa_Data("out_log_datetime").Direction =
>> >> > ParameterDirection.Output
>> >> >
>> >> >            pa_Data.Add("io_session_id", OracleType.Number, 10)
>> >> >            pa_Data("io_session_id").Direction =
>> >> > ParameterDirection.InputOutput
>> >> >            pa_Data("io_session_id").Value = lngSessionID
>> >> >
>> >> >            pa_Data.Add("in_user_id", OracleType.VarChar, 12)
>> >> >            pa_Data("in_user_id").Direction = ParameterDirection.Input
>> >> >            pa_Data("in_user_id").Value = strUserName
>> >> >
>> >> >            pa_Data.Add("in_login_ip_addr", OracleType.VarChar, 15)
>> >> >            pa_Data("in_login_ip_addr").Direction =
>> >> > ParameterDirection.Input
>> >> >            pa_Data("in_login_ip_addr").Value = strLoginIPAddr
>> >> >
>> >> >            pa_Data.Add("in_log_type", OracleType.VarChar, 1)
>> >> >            pa_Data("in_log_type").Direction =
>> >> > ParameterDirection.Input
>> >> >            pa_Data("in_log_type").Value = IIf(l_Type = LogType.Login,
>> >> > "I", IIf(l_Type = LogType.Logout, "O", "I"))
>> >> >
>> >> >            pa_Data.Add("ret_Value", OracleType.VarChar, 1)
>> >> >            pa_Data("ret_Value").Direction =
>> >> > ParameterDirection.ReturnValue
>> >> >
>> >> >            clsSttstwDB.ExecuteSql("upkg_stt_usr_log.fn_user_log",
>> >> > CmdExecType.NonQuery, pa_Data, Nothing)
>> >> >
>> >> >            'Store Information
>> >> >            Select Case l_Type
>> >> >                Case LogType.Login
>> >> >                    'Login
>> >> >                    lngSessionID = pa_Data("io_session_id").Value
>> >> >                    strLoginDatetime = pa_Data
>> >> > ("out_log_datetime").Value
>> >> >                Case LogType.Logout
>> >> >                    'Logout
>> >> >                    strLogoutDatetime = pa_Data
>> >> > ("out_log_datetime").Value
>> >> >            End Select
>> >> >
>> >> >            blnSuccess = (pa_Data("ret_Value").Value = "1")
>> >> >        Catch exLog As Exception
>> >> >            '
>> >> >        End Try
>> >> >
>> >> >        LogUserAction = blnSuccess
>> >> >    End Function
>> >> >
>> >> >    Public Sub New()
>> >> >        'Initialize values
>> >> >        lngSessionID = -1
>> >> >        strUserName = ""
>> >> >        strUserFullNameEN = ""
>> >> >        strUserFullNameCN = ""
>> >> >        strUserGroupID = ""
>> >> >        strDistOfficeCode = ""
>> >> >        bltUpdateOtherDistrict = BoolType.NotSet
>> >> >        bltEnquiryOtherDistrict = BoolType.NotSet
>> >> >        strLoginDatetime = ""
>> >> >        strLogoutDatetime = ""
>> >> >    End Sub
>> >> >
>> >> >    Protected Overrides Sub Finalize()
>> >> >        '
>> >> >        MyBase.Finalize()
>> >> >    End Sub
>> >> > End Class
>> >> >
>> >> > On 9月2日, 下午6時59分, Andrew Badera <[email protected]> wrote:
>> >> >> On Wed, Sep 2, 2009 at 4:42 AM, Gerard<[email protected]> wrote:
>> >> >>
>> >> >> > Dear sir or madam,
>> >> >>
>> >> >> > I have the problem to our web application using asp.net 2.0. The
>> >> >> > problem is that when user A login and then user B login, user A
>> >> >> > creates an item and saved. However, the item's created by and
>> >> >> > updated
>> >> >> > by are mentioned that it is created by user B!!!
>> >> >>
>> >> >> > I think there is some mess up with thesessionproblem. User A's
>> >> >> >sessionhas been overwrited by user B. Mysessionstate is
>> >> >> > <sessionState
>> >> >> > mode="InProc"
>> >> >> > cookieless="false"
>> >> >> > timeout="60"
>> >> >> > />
>> >> >>
>> >> >> > Does anyone can help me with this ?? Thanks in advance!1
>> >> >>
>> >> >> > Regards,
>> >> >> > Gerard
>> >> >>
>> >> >> Step 1: This has nothing to do withsessionlength, and probably
>> >> >> nothing to do with login state.
>> >> >> Step 2: Show us some code, via pastebin.com or similar, where the
>> >> >> data
>> >> >> is supposed to be recorded, and where it is supposed to be
>> >> >> loaded/displayed.
>> >> >>
>> >> >> ∞ Andy Badera
>> >> >> ∞ This email is: [ ] bloggable [x] ask first [ ] private
>> >> >> ∞ Google
>> >> >> me:http://www.google.com/search?q=(andrew+badera)+OR+(andy+badera)-
>> >> >> 隱藏被引用文字
>> >> >> -
>> >> >>
>> >> >> - 顯示被引用文字 -
>> >> >
>> >
>> >
>
>

Reply via email to