i try simple web page, for first time i add session "aa" var, and i add
button, and i check if
session keep aa value in postback.
when i add call to Dataadapter.fil l method, i lost my session on postback,
and i get isNewSession=tr ue!!
help please!
=============== =============== =
heare my code:
the web.config:
=============== =
<sessionState
mode="InProc"
stateConnection String="tcpip=1 27.0.0.1:42424"
sqlConnectionSt ring="data source=127.0.0. 1;Trusted_Conne ction=yes"
cookieless="tru e"
timeout="520"
/>
=============== =========
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Web Form1.aspx.vb" Inherits="asp1. WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
<asp:Button id="btnCalc" style="Z-INDEX: 104; LEFT: 320px; POSITION:
absolute; TOP: 104px" runat="server"
Width="225px" Height="79px" Text="รงรนรก"></asp:Button></form>
</body>
</HTML>
=============== =============== =========
Public Class WebForm1
Inherits System.Web.UI.P age
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.cnn = New System.Data.Ole Db.OleDbConnect ion
'
'cnn
'
Me.cnn.Connecti onString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=0;Data
Source=""C:\Ine tpub\wwwroot\as p1\bin\CHANGE.m db"";Mode=Sha re De" & _
"ny None;Jet OLEDB:Engine
Type=4;Provider =""Microsoft.Je t.OLEDB.4.0"";J et OLEDB:Sys" & _
"tem database=;Jet OLEDB:SFP=False ;persist security
info=False;Exte nded Propertie" & _
"s=;Jet OLEDB:Compact Without Replica Repair=False;Je t OLEDB:Encrypt
Database=Fal" & _
"se;Jet OLEDB:Create System Database=False; Jet OLEDB:Don't Copy
Locale on Compact" & _
"=False;Use r ID=Admin;Jet OLEDB:Global Bulk Transactions=1"
End Sub
Protected WithEvents cnn As System.Data.Ole Db.OleDbConnect ion
Protected WithEvents btnCalc As System.Web.UI.W ebControls.Butt on
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If Not (IsPostBack) Then
Dim adp As New OleDb.OleDbData Adapter("select * from tblChange",
cnn)
Dim tbl As New DataTable
adp.Fill(tbl) <==
Session.Add("aa ", 99) <===
End If
End Sub
Private Sub btnCalc_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnCalc.Click
End Sub
End Class
button, and i check if
session keep aa value in postback.
when i add call to Dataadapter.fil l method, i lost my session on postback,
and i get isNewSession=tr ue!!
help please!
=============== =============== =
heare my code:
the web.config:
=============== =
<sessionState
mode="InProc"
stateConnection String="tcpip=1 27.0.0.1:42424"
sqlConnectionSt ring="data source=127.0.0. 1;Trusted_Conne ction=yes"
cookieless="tru e"
timeout="520"
/>
=============== =========
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Web Form1.aspx.vb" Inherits="asp1. WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
<asp:Button id="btnCalc" style="Z-INDEX: 104; LEFT: 320px; POSITION:
absolute; TOP: 104px" runat="server"
Width="225px" Height="79px" Text="รงรนรก"></asp:Button></form>
</body>
</HTML>
=============== =============== =========
Public Class WebForm1
Inherits System.Web.UI.P age
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.cnn = New System.Data.Ole Db.OleDbConnect ion
'
'cnn
'
Me.cnn.Connecti onString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=0;Data
Source=""C:\Ine tpub\wwwroot\as p1\bin\CHANGE.m db"";Mode=Sha re De" & _
"ny None;Jet OLEDB:Engine
Type=4;Provider =""Microsoft.Je t.OLEDB.4.0"";J et OLEDB:Sys" & _
"tem database=;Jet OLEDB:SFP=False ;persist security
info=False;Exte nded Propertie" & _
"s=;Jet OLEDB:Compact Without Replica Repair=False;Je t OLEDB:Encrypt
Database=Fal" & _
"se;Jet OLEDB:Create System Database=False; Jet OLEDB:Don't Copy
Locale on Compact" & _
"=False;Use r ID=Admin;Jet OLEDB:Global Bulk Transactions=1"
End Sub
Protected WithEvents cnn As System.Data.Ole Db.OleDbConnect ion
Protected WithEvents btnCalc As System.Web.UI.W ebControls.Butt on
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If Not (IsPostBack) Then
Dim adp As New OleDb.OleDbData Adapter("select * from tblChange",
cnn)
Dim tbl As New DataTable
adp.Fill(tbl) <==
Session.Add("aa ", 99) <===
End If
End Sub
Private Sub btnCalc_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnCalc.Click
End Sub
End Class