Re: Object in session question

From: Karl Seguin (_at_)
Date: 02/03/05


Date: Thu, 3 Feb 2005 08:59:51 -0500

Chris,
Perhaps I misunderstood, but what do you see as the problem? Simply the use
of sessions? You said "isn't he putting a page into a session object?" not
sure what you mean by this, but no he isn't. He doesn't do
Session("CurrentPage") = Page ....

Sessions are bad only when used incorrectly. You haven't given us quite
enough scope to really pass judgement...I would guess that a lot of this
could probably be rewritten without sessions...and probably be better for it

Karl

-- 
MY ASP.Net tutorials
http://www.openmymind.net/
"Chris" <Chris@discussions.microsoft.com> wrote in message
news:9E66F345-D9A1-4FB6-B803-E639ECC5A648@microsoft.com...
> I'm on a project where the prevoius developer wrote code like below. I
> thought stuff like this was bad? Isn't he putting a page into a session
> object? And what we are trying to do is hit the db via a Stored Proc to
> create a datatable in most cases. This seems like a waste to me. Is this
good?
>
> Public Shared Function getSQL(ByRef thePage As Page) As
ProjectName.SQLServer
>
>         If thePage.Session("mySQLInit") = "1" Then
>
>             Return thePage.Session("mySQL")
>         End If
>
>         thePage.Session("mySQL") = New ProjectName.SQLServer
>         thePage.Session("mySQLInit") = "1"
>
>         Return thePage.Session("mySQL")
>     End Function
>
> And then shoots to the SP to create datatable:
>
> Sub FillDataGrid(ByRef gridData As System.Web.UI.WebControls.DataGrid,
ByVal
> SQL As String, Optional ByVal bAddNew As Boolean = False)
>
>             Dim cnn As SqlConnection = New
>
SqlConnection(ConfigurationSettings.AppSettings().Item("ConnectionString"))
>
>             Dim dt As DataTable = New DataTable("")
>             Dim dr As DataRow
>
>             Dim objDA As SqlClient.SqlDataAdapter
>             objDA = New SqlClient.SqlDataAdapter
>
>             dt = ExecSQLReturnDT(SQL, objDA)
>
>             If bAddNew Then
>                 dr = dt.NewRow
>                 dt.Rows.InsertAt(dr, 0)
>                 gridData.EditItemIndex = 0
>             End If
>
>             gridData.DataSource = dt
>             gridData.DataBind()
>
>         End Sub
>
> And I see dozens of this:
>
>  page.Page.Session("psedit_PSHistoryID") = ""
>
>
>


Relevant Pages

  • Re: session_set_cookie_params and session_save_path
    ... it saves my sessions to that path. ... You've possibly misunderstood the "path" parameter on ... http://www.andyhsoftware.co.uk/space:: disk and FTP usage analysis tool ...
    (comp.lang.php)
  • Re: Re: Kernel 2.4
    ... I misunderstood your question and can't help on the 2.6 ... All the logs are in /var/log, so looking there for your 2.6 sessions' ... Good luck! ... To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org ...
    (Debian-User)